Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

inventoryPolicy bug?

inventoryPolicy bug?

sullyc
Shopify Partner
1 0 0

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.

Reply 1 (1)

LucaRaveri
Shopify Partner
20 3 7

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.

If this was helpful, please Like it ⬆️
If this solved your problem, please Mark it as solution