Announcement

Collapse
No announcement yet.

Inventory Variants Stock

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Inventory Variants Stock

    We have several multi-pack kits that are 1 each of several products. I have created these products using inventory variants (there are no attributes as the customer does not get to choose what's in the kit). When I add the kit to my cart it successfully deducts each product's inventory count. The issue is I cannot figure out how to hide the product add to cart if any one of the products are out of stock. I can do this at the single product level, but not when using variants.

    I have code around the add to cart for single products that works fine, but cannot figure out how to do this in inventory variants case.

    I hope this makes sense, and thanks for any help.

    #2
    I'm dealing with this right now.

    I had to pull the inventory variants - and therefore their stock - and do some custom coding.

    https://docs.miva.com/code-samples/load-variant-data

    I loaded the variants, determined the quantity of variants total, checked the stock of each individual variant, loaded them into an array if they were in stock, counted the number of entries in the array, then compared it to the number of variants total. If they were equal, then it allowed them to add to cart, if the number of in stock variants was below the total number of variants, it wouldn't allow it.

    If you want to PM me I can help you work through the code that I used and maybe you can find a solution that works for you.

    Comment

    Working...
    X