Shopify themes, liquid, logos, and UX
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?
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.
User | RANK |
---|---|
61 | |
53 | |
47 | |
39 | |
39 |
Photo by Marco Verch Sales channels on Shopify are various platforms where you can sell...
By Ollie May 25, 2023Summary of EventsBeginning in January of 2023, some merchants reported seeing a large amo...
By Trevor May 15, 2023With 2-Factor Authentication being required to use Shopify Payments, we’re here to help yo...
By Imogen Apr 26, 2023