I'm using expresso store and apart from regular products I have gift boxes which contain multiple products. They are a separate channel and I'm using playa to pick the products for each gift box entry.
what I need to do is check the stock level for each individual product and if any of those products are out of stock then the gift box should not be available for purchase.
If I put the conditional inside the loop then I will get 3-4 results and I only need one of them to be 0 in order to hide the add to cart button.
So I need a conditional that will wrap around all of the related entries for the gift box and if any of the items have a stock level of 0 it should disable to button.
EDIT: so the code I have for normal products is as follows:
{if total_stock > 0}
<input type="submit" name="submit" value="add to cart"/>
{if:else}
<p>Product is unavailable</p>
{/if}
what I need for gift boxes should be something like:
{if "{exp:playa:children field="gift_products"}{stock}{/exp:playa:children}"
*="0"}
<p>Product is unavailable</p>
{if:else}
<input type="submit" name="submit" value="add to cart"/>
{/if}
so if the stock level of multiple related products is 0 add to cart should not be available