[Shopify] Sync HS Code and Country of Origin on variant export#7414
[Shopify] Sync HS Code and Country of Origin on variant export#7414
Conversation
- Add Tariff No. and Country/Region of Origin Code fields to Shpfy Variant table - Populate HS code and country of origin from Item during product creation and export - Include harmonizedSystemCode and countryCodeOfOrigin in variant CREATE and UPDATE GraphQL mutations - Add open-source ExternalURL extension app that syncs external_url variant metafields via configurable URL template - Add tests for HS code and country of origin on product creation Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
a6adf52 to
c4f49ff
Compare
There was a problem hiding this comment.
AL Documentation Audit
Documentation gaps were detected in the following apps:
- Shopify-Connector-Test: 0% documentation coverage
- Shopify-External-URL: 0% documentation coverage
To generate documentation, run /al-docs init or /al-docs update using GitHub Copilot CLI or Claude Code.
This review is for awareness to help keep documentation in sync with code changes. It is okay to dismiss this request.
…te/onbuyuka/shpfyagenticplan
…te/onbuyuka/shpfyagenticplan
Shopify rejects external_url metafield values without a scheme (protocol). Added OnValidate trigger to error if template doesn't start with https:// or http://. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…bility example The external_url metafield extension is now documented as a step-by-step extensibility example in the Extending Shopify docs page. Source code is not shipped; partners build it as a PTE from the documentation. See: MicrosoftDocs/dynamics365smb-devitpro#7259 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Look up Country/Region table and use ISO Code instead of raw BC country code when populating countryCodeOfOrigin for Shopify GraphQL. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
97adff9 to
a1dae30
Compare
Add "Sync HS Code and Country" boolean on Shpfy Shop (field 209, default on) and gate all variant-field assignments and GraphQL fragments in Create/Update paths so the fields are only sent when the shop opts in. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The write-layer gates in ShpfyCreateProduct and ShpfyProductExport already prevent the fields from being populated when the toggle is off, so the existing empty/diff checks in VariantAPI short-circuit naturally. Matches the codebase pattern for Sync Item Extended Text / Marketing Text / Attributes (single gate at write layer). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Resolve conflict in ShpfyShop.Table.al: main added fields 207/208 (Advanced Shopify Plan, Find Mapping by Barcode); keep both and place the new field 209 (Sync HS Code and Country) after them.
There was a problem hiding this comment.
Pull request overview
This PR extends the Shopify product sync to include customs-related variant data (HS code and country of origin) so exported variants meet Shopify/AI channel distribution requirements.
Changes:
- Adds
Tariff No.andCountry/Region of Origin Codefields toShpfy Variantand populates them during variant creation/export when enabled. - Introduces a new shop setting Sync HS Code and Country of Origin (default on) and surfaces it on the Shop Card.
- Updates Shopify GraphQL variant mutations to send
harmonizedSystemCodeandcountryCodeOfOrigin, and adds unit tests for field population.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Apps/W1/Shopify/Test/Products/ShpfyCreateProductTest.Codeunit.al | Adds tests validating HS code and country of origin population on temp variants. |
| src/Apps/W1/Shopify/App/src/Products/Tables/ShpfyVariant.Table.al | Adds new persisted fields on the Shopify Variant table for HS code and origin country. |
| src/Apps/W1/Shopify/App/src/Products/Codeunits/ShpfyVariantAPI.Codeunit.al | Extends GraphQL mutation payloads to include harmonizedSystemCode and countryCodeOfOrigin. |
| src/Apps/W1/Shopify/App/src/Products/Codeunits/ShpfyProductExport.Codeunit.al | Populates the new variant fields during export and adds GetCountryISOCode helper. |
| src/Apps/W1/Shopify/App/src/Products/Codeunits/ShpfyCreateProduct.Codeunit.al | Populates the new variant fields during temp product/variant creation paths. |
| src/Apps/W1/Shopify/App/src/Base/Tables/ShpfyShop.Table.al | Adds a new shop-level boolean to gate syncing HS code and country of origin. |
| src/Apps/W1/Shopify/App/src/Base/Pages/ShpfyShopCard.Page.al | Exposes the new shop setting on the Shop Card UI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Outer inventoryItem guard in UpdateProductVariantGraphQLQuery now includes Tariff No. and Country/Region of Origin Code, so changing only those fields actually emits the inventoryItem payload. - Align DataClassification on Tariff No./Country fields with the rest of Shpfy Variant (CustomerContent). - Make the 3 new tests explicitly set Shop.\"Sync HS Code and Country\" in their GIVEN blocks rather than relying on InitValue=true. - Rename UnitTestCreateTempProductWithVariantsSetsHSCode to also mention Country of Origin since the test asserts both fields. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Clearing Country/Region of Origin Code on an Item previously caused the update mutation to emit 'countryCodeOfOrigin: ' with no value, which Shopify rejects as a parse error. Emit 'null' explicitly to clear the field instead. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Summary
Addresses gaps identified in the Shopify Agentic Plan Product Sync Guide to ensure BC product catalogs meet the data requirements for AI channel distribution.
Item."Tariff No."asharmonizedSystemCodeon variant export (both create and update paths)Item."Country/Region of Origin Code"ascountryCodeOfOriginon variant exportShpfy Varianttable and populated inCreateTempProduct(4 code paths) andFillInProductVariantData(3 overloads)Sync HS Code and Country of Originboolean on the Shop card (default on) gates the variant-field population, matching the pattern used bySync Item Extended Text/Marketing Text/AttributesRelated docs PR for External URL extensibility example: MicrosoftDocs/dynamics365smb-devitpro#7259
Fixes AB#632223