Automatically change a product template when the product is sold out

Hello,

Is there a way to change a product to a specific theme template when the product sells out? For instance, instead of displaying a sold out tag on the image and sold out when you go to the product page, is there a way to switch to a theme template that has a quote form? I have the templates already made and they work but I was wondering if there’s a way to auto switch templates when sold out condition is met.

2 Likes

Hello! I am not sure there is a possibility to switch template automatically but you could do something like execute a different code under a conditional logic:

{% if product.inventory <= 0  %}/// your code here...   {% else %}/// your code here...{% endif %}

Typically you would insert the code of your quote form after the first condition ( the “if” statement).

I hope that helps.