Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
Hi guys,
Is there a way to filter products that are 'in stock only' in my storefront api call? Can you show me an example?
Found it 🙂
{
shop {
products(first: 10, query: "published_status:published AND available_for_sale:true")
}
}
Hello dev88,
i) Using Admin Product API you can get all products array. used below Admin API to get Products
'store_url/admin/products.json'
ii) get the "variants" from products array
iii) get "inventory_quantity" from "variants" array
iv) if "inventory_quantity" is grater than "0" then product is "In Stock" otherwise product is "Out of Stock"