Finding a way to set "Country/Region of origin" via flow

Is there a way to use Flow to populate the “Country/Region of origin” field on newly created products based on a product tag? I have to do this in bulk, and am trying to find a way to automate it…

You might be able to create a workflow that starts with a Product created trigger then a Send Admin API request action using the inventoryItemUpdate to update the countryCodeOfOrigin field on the InventoryItem. It might be hard to use a product tag to populate the field though, as a product can have multiple tags, so you may need to use a specific metafield or the value from another field instead.

1 Like

Yep, Yes, you can use Shopify Flow to set the “Country/Region of Origin” field automatically based on a product tag. While Shopify Flow doesn’t have a direct action to modify this specific field, you can work around it using Metafields or by leveraging an external app that integrates with Flow.

One approach is to create a workflow that triggers when a product is created. You can set a condition to check if the product contains a specific tag, and then use an action to update a corresponding Metafield with the country of origin. If your store’s theme or an external app allows pulling data from Metafields, this could effectively populate the field.

Another option is using a third-party app like Mechanic, which allows scripting automation beyond Flow’s built-in capabilities. With Mechanic, you could write a script that detects newly added products, checks their tags, and assigns the correct country/region.

If you are comfortable with API-based solutions, Shopify’s Admin API can be used to bulk update product attributes, including the country of origin. A script could be written to scan products, detect the assigned tags, and update the necessary field accordingly.

If none of these options work within your setup, you may need to manually update products in bulk using Shopify’s CSV import/export feature. While not fully automated, it allows for quick edits by modifying the CSV file and re-uploading it.

Thank you very much for your help! I got partway through setting up a test flow as per your advice, but I am not sure how to write a “mutation input.” (I think the multiple tags part will be ok, because there is an “at least one of” option!) Do you have any further advice…?

This might require a Product variant added trigger instead, since that returns an inventoryItem id that can be inserted into the mutation input as a variable. Then the mutation input probably looks something like this, but I haven’t tested it:

{
  "id": "{{productVariant.inventoryItem.id}}",
  "input": {
    "countryCodeOfOrigin": "JP"
  }
}
1 Like

Thank you so much for your help, this worked perfectly!

1 Like