Anyway to auto assign a "Theme template" to a product?

Highlighted
Excursionist
52 0 7

Hi, pretty much as the title asks, is there anyway at all of auto assigning an existing product theme template to my products? 

 

screenshot1.jpg

 

I know we can bulk edit our products through the products section within Shopify, but what we would ideally like is a rule written so that if a product drops below "0" in inventory, the product layout alters to a second layout. I would also want us to be able to override and manually alter the theme for each product to.

 

I know this might no be possible without a lot of work, so even if we can use product tags or based on collection etc in anyway it would be great.

 

Any help would be great!

0 Likes
Highlighted
Excursionist
52 0 7

I have researched this for a long time now and still not found a possible solution, just giving the post a bump to see if anyone else could reccomend something? If anyone from Shopify could confirm if this is possible or not even?

 

Thanks

0 Likes
Highlighted
New Member
2 0 0

You're not able to do it with the Product Templates (unless there is a supporting app), but you can look into the Liquid a bit more to help with this.

 

Most themes will have a product.liquid section in the product.liquid template file. You can use liquid to look to see if the product is available (has inventory or not) and alter the theme that way based on the result.

 

For example, you have two sections setup, one section for the product layout when it has inventory (product-in-stock.liquid), and one when it does not (product-sold-out.liquid)

 

 

{% if product.available %}
    {% section 'product-in-stock' %}
{% else %}
    {% section 'product-sold-out' %}
{% endif %}

 

Don't forget to smash that Like button if I've helped you out!
If you're question was answered, don't forget to Accept the Solution!
0 Likes