Symmetry Theme

stylitics
New Member
1 0 0

Trying to add a javascript widget to the default product page.  I was able to do this easily with our former theme Showcase by adding my custom section containing the widget code like this {% section 'stylitics-v3-classic' %} to the .liquid page. 

 

But this theme has .json files.  I followed a tutorial to add a custom section to the .json file and that's working fine.  But when I go to customize the theme and choose the default product page I'm not seeing the option to add my customized section.  

 

How do I get my .js to appear on the default product page?

Reply 1 (1)
EcomGraduates
Shopify Partner
588 48 63

It sounds like you've already added your custom section containing the widget code to the .json file, but you're not seeing the option to add the customized section to the default product page in the theme customization settings.

To make sure that your custom section appears in the theme customization settings, you will need to add it to the product-template.liquid file in addition to the .json file. Here's an example of what the code should look like:

 

 

{% if section.settings.enable_custom_widget %}
  {% section 'custom-widget' %}
{% endif %}

 

 

In the code above, replace 'enable_custom_widget' with the name of the setting you want to use in the customization settings, and replace 'custom-widget' with the name of your custom section.

Once you've added the code to the product-template.liquid file, you should be able to see and select your custom section in the theme customization settings for the default product page.

 

You have a business to run. Let us handle the theme.
115+ ★★★★★ star reviews
Check Out Our New Theme -Ecomify
Do you need help building a brand?