Hiya,
I’m creating a Checkout Extension which I only want to show when one or more items in the cart have oversold (their resulting inventory is or will be less than 0) this will be for Back-Orders i.e. variants with a ‘Continue selling when out of stock’.
Currently I’m doing this by grabbing all of the Unique Variant IDs and doing a Storefront API lookup, but.. I can’t find a way to do it based upon the Buyer Context (Company Location), which could impact things - as the Customer Token (from what I can see) isn’t available.
Secondly, I feel like I should be querying the cart, rather than the variants separately - but there doesn’t seem to be a way to fetch the Cart ID either..
query VariantData($country: CountryCode! $variantIds: [ID!]!) @inContext(country: $country) {
nodes(ids: $variantIds) {
... on ProductVariant {
title
currentlyNotInStock
quantityAvailable
product {
title
}
}
}
}
So, is there a better way to achieve this?
Thanks in Advance