Can you remove country-specific HS codes via the GraphQL API?

The inventoryItemUpdate and productVariantsBulkUpdate mutations now have the countryHarmonizedSystemCodes input argument which allows you to set country-specific HS codes (which is great!). This appears to add new country-specific HS codes to the variant, but I don’t see a way to remove an HS code for a specific country.

I’ve tried passing in null or blank values like this but it doesn’t work:

{
  "id": "gid://shopify/InventoryItem/00000000000000",
  "input": {
    "countryHarmonizedSystemCodes": [
      {
        "harmonizedSystemCode": "6217109510",
        "countryCode": "CA"
      },
      {
        "harmonizedSystemCode": null,
        "countryCode": "US"
      }
    ]
  }
}

And since it just adds new country-specific codes, omitting the country from the input doesn’t delete it.

When you delete a country-specific HS code in the Shopify Admin their GraphQL API has a countryHarmonizedSystemCodesToDelete field but I don’t see that in any of the public GraphQL API versions.

Is there any way to delete country-specific HS codes via the API or can we only set them?

Thanks

Hey @Daniel_Ablestar

It does look like the field you’ve found is not part of the public API, and for now you’ll need to rely on the admin to delete these. I’m investigating to see whether this will be released to the public API.

1 Like