A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Calling a mutation from C# code - productVariantsBulkCreate passing in the ID of a newly created product to create a new product variant with strategy "REMOVE_STANDALONE_VARIANT"
Variant params barcode, price, inventoryPolicy="CONTINUE", also supplying an inventory item purely to get the product sku in as well.
All works EXCEPT inventoryPolicy is not set - it remains as "DENY". No errors.
Anybody got this to work as I'm starting to think it is a bug?
See https://shopify.dev/docs/api/admin-graphql/2024-04/objects/ProductVariant#field-inventorypolicy
I shall try and replicate in GraphiQL next and see if that provides any additional feedback. Maybe try a workaround - maybe I'll have more joy with an update.
Definetely you should try to replicate the problem with GraphiQL.
I tried this on a random product of my test store and everything seems to work, even if i switch inventoryPolice from CONTINUE to DENY.
mutation {
productVariantsBulkCreate(
productId: "gid://shopify/Product/8216968134915",
variants: [
{
barcode: "123456789",
price: "29.99",
inventoryPolicy: CONTINUE,
inventoryItem: {
sku: "ABC"
}
}
],
strategy: REMOVE_STANDALONE_VARIANT
) {
productVariants {
id
inventoryPolicy
}
userErrors {
field
message
}
}
}
I'm working with the 2024-07 version tho.