HarmonisedSystemCode being rejected by GraphQL productCreate request

Solved

HarmonisedSystemCode being rejected by GraphQL productCreate request

LukeRotherfield
Shopify Partner
6 0 2

I am making a bulk productCreate request with the following JSONL file content (obfuscated, and formatted for ease):

{
    "input": {
        "descriptionHtml": "",
        "handle": "example-product",
        "status": "ARCHIVED",
        "options": [
            "Size"
        ],
        "title": "EXAMPLE PRODUCT",
        "variants": [
            {
                "inventoryItem": {
                    "tracked": true,
                    "harmonizedSystemCode": "62046239"
                },
                "inventoryQuantities": [
                    {
                        "availableQuantity": 9999,
                        "locationId": "gid:\/\/shopify\/Location\/XXX"
                    }
                ],
                "inventoryManagement": "SHOPIFY",
                "inventoryPolicy": "DENY",
                "options": [
                    "L"
                ],
                "price": "100.000000",
                "compareAtPrice": "150.000000",
                "requiresShipping": true,
                "sku": "EXAMPLEL",
                "title": "EXAMPLE LARGE"
            }
        ],
        "seo": {
            "title": "EXAMPLE PRODUCT",
            "description": "EXAMPLE PRODUCT DESCRIPTION"
        }
    }
}

And I am getting the following response:

Invalid Bulk Mutation Field - Variable $input of type ProductInput! was provided invalid value for variants.0.inventoryItem.harmonizedSystemCode (Field is not defined on InventoryItemInput)

But it looks like InventoryItemInput does have the harmonizedSystemCode field https://shopify.dev/docs/api/admin-graphql/2024-04/input-objects/InventoryItemInput

 

What am I getting wrong?

 

Cheers

Luke

Accepted Solution (1)

Ronak_Karia
Shopify Partner
1 1 1

This is an accepted solution.

Shot in the dark guess:

Your submitting the data in a diffrent verison to 2024-04 graphQL version

Previous verison before 2024-04 have diffrent input structures.

 

Try there app and see if it works there:

https://shopify-graphiql-app.shopifycloud.com/

View solution in original post

Replies 2 (2)

Ronak_Karia
Shopify Partner
1 1 1

This is an accepted solution.

Shot in the dark guess:

Your submitting the data in a diffrent verison to 2024-04 graphQL version

Previous verison before 2024-04 have diffrent input structures.

 

Try there app and see if it works there:

https://shopify-graphiql-app.shopifycloud.com/

LukeRotherfield
Shopify Partner
6 0 2

Hey Ronak

 

Thanks for responding, this was indeed the issue and I didn't come back here to report a resolution.  I started building the app at the end of 2023 and so had the api version set as 2023-10.  When I switched to 2024-04 I ended up having to rebuild much of the product importer as 2024-04 handles variant creation in a very different way, you can't actually include variants in a bulk product create anymore!

 

Thanks again

Luke