Quantcast
Channel: Opinion: Shopify Community - Shopify APIs & SDKs
Viewing all articles
Browse latest Browse all 25503

How do I get Product Variant Quantity using AJAX ? by Sprouter

$
0
0

Hello,

I'm making the following AJAX request and I get a JSON object of all available products along with all the relevant details for every variant of every product :

jQuery.ajax({
    url: "//xxxxxxx.myshopify.com/products.json?limit=250",
    success: function(response)
    {

       window.products = response.products;

    }

});

However, there is one very essential bit of information missing for every variant of every product and that is the available quantity.

I get a variant.is_available which I guess tells me whether the variant quantity is at least 1.

But, I need to know the exact available quantity for this variant.

What if the customer selects (from the quantity dropdown I've built..) a quantity equal to 5 but the actual available quantity is 3 ??

Thank you in advance for your help!

 


Viewing all articles
Browse latest Browse all 25503

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>