Filtering stock of products (where it's > 0) #386
-
Hi Swell dev team, I was looking through the documentation on filtering products, and it looks like you can filter by price, category, and size. Is it possible to filter products where the stock is greater than 0? |
Beta Was this translation helpful? Give feedback.
Answered by
logeshswell
Sep 27, 2023
Replies: 1 comment
-
Yes, it is possible to filter products where the stock > 0. import swell from 'swell-js'
swell.init('<store-id>', '<public_key>');
const response = await swell.products.list({
stock_status: 'in_stock'
});
// Alternate way
const response = await swell.products.list({
stock_level: {
$gt: 0
},
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
logeshswell
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, it is possible to filter products where the stock > 0.