Ad

Assign A Different Class To Shopify-section Depending On Page

- 1 answer

In a blog section on my site I specify a class to be added onto shopify-section in my schema code. Here's a snapshot of that code (I'll not post it all):

{% schema %}
  {
    "name": "Blog",
    "class": "band band--tint",
    "settings": [

That works great however in my product.liquid the layout is slightly different and I don't want the band--tint class on that page.

Is there a way I can target the handle/template so I can remove this class just for that layout?

Ad

Answer

You can just create an alternate template to modify HTML.

Creating an alternate template allows you to modify the way content is shown on your online store, but only for the products, collections, blogs, and other pages that you apply the alternate template to. For example, you can create an alternate product template that has no add to cart button, and apply it only to products that are not for sale. Or, you can create an alternate page template that doesn’t include a header, and apply it to a selection of your store’s pages.

Source/customization/store/create-alternate-templates" rel="nofollow noreferrer">Source

Ad
source: stackoverflow.com
Ad