I'm having a problem with the inventory field in a product in cartthrob. For my product, there are color variations for each product and the inventory is assigned accordingly.
When displaying the products on the "add to cart" page, the cartthrob options tag will check for inventory and only display the color if it's in stock.
The problem is that if the inventory reaches 0 on both color variations, the options will still show the product (with an empty select tag).
How can I have this product not show up in my template logic if there is no inventory left for any of the variations?
{options}
{if inventory !=0 }
<select>
<option name="item_options[product_color]" value="{option_value}">{option_name}</option>
</select>
{/if}
{/options}
Ideally, if all inventory is at 0 in these product fields, I'd like a message to show the product is out of stock and not allow the add to cart functionality.
{if inventory ==""}
to work. – Natetronn Dec 10 '13 at 18:18