[Shopify] Import HS code and country of origin from Shopify#9320
Open
onbuyuka wants to merge 1 commit into
Open
[Shopify] Import HS code and country of origin from Shopify#9320onbuyuka wants to merge 1 commit into
onbuyuka wants to merge 1 commit into
Conversation
Populate the item's Tariff No. and Country/Region of Origin Code when creating or updating items from Shopify products, gated on the shop's "Sync HS Code and Country" setting. - Fetch inventoryItem.harmonizedSystemCode and mirror it (plus countryCodeOfOrigin) onto the Shopify variant during import. - Only apply the tariff when it already exists in BC (never create a Tariff Number). Shopify returns HS codes without separators, so a separator-less code is matched to a BC Tariff Number by comparing digits (exact match first, digit comparison as fallback). - Resolve the country ISO code to a BC Country/Region via "Shpfy Process Order".GetCountryCode. - On update, never wipe an existing value with an unmapped/blank one. - Make export tariff change-detection separator-insensitive so bidirectional shops do not get redundant pushes. Fixes AB#642046 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 60cf214c-d3e4-42ed-ab60-beea16225579
Contributor
Copilot PR ReviewIteration 1 · Outcome: completed
Knowledge source: https://github.com/microsoft/BCQuality@822cae1b2771ac25f665f73369f69093bd4fd630 Orchestrator pre-filter (13 file(s) excluded)
Findings produced by the Copilot CLI agent against BCQuality at |
JesperSchulz
approved these changes
Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Bug 642046 (follow-up to #632223, which added exporting HS code / country of origin to Shopify): when importing a product from Shopify to create a Business Central item, the Tariff No. and Country/Region of Origin Code were left empty. This adds the import direction.
When the shop's Sync HS Code and Country setting is enabled:
inventoryItem.harmonizedSystemCodeis fetched and mirrored (withcountryCodeOfOrigin) onto the Shopify variant.6104.43comes back as610443), a separator-less code is matched to a BC Tariff Number by comparing digits (exact match first, digit comparison as a fallback)."Shpfy Process Order".GetCountryCode.Linked work
Fixes AB#642046
How I validated this
What I tested and the outcome
ShpfyCreateItemTest: create populates HS/country (with ISO->BC country resolution); no sync when setting disabled; tariff skipped when not in BC; separator-less Shopify code matched to a dotted BC tariff; update refreshes HS/country; update preserves an existing tariff when the Shopify value is not in BC.ShpfyCreateItemAPITest: end-to-end import via mocked GraphQL response (fixture updated to return the separator-less HS code as Shopify does) resolves the item to the dotted BC tariff.Risk & compatibility
tabledata "Tariff Number" = rpermission toShpfy Create Item.