Hi, I’m trying to use the Shopify API to query only active automatic discounts. Currently, I can only retrieve automatic discounts that have been applied manually to specific products. However, I need to display both products selected individually as well as products selected through collections in the same query.
Here’s what I’m looking to achieve:
- Retrieve only active automatic discounts.
- Include both products selected individually and products selected through collections in the results.
Any guidance on how to structure this query to achieve these requirements would be greatly appreciated!
I’m very new to API topics, so I’m sharing what I’ve managed to do so far:
const discountProducts = await api.query(
query {
shopifyDiscount(id: "1467432862010") {
id
title
customerGetsProducts {
edges {
node {
id
title
variants {
edges {
node {
id
price
title
}
}
}
}
}
}
customerGetsCollections {
edges {
node {
id
title
}
}
}
}
}
);
console.log(JSON.stringify(discountProducts, null, 2));