[Bug]: Shopify variant create uses wrong option name after initial import from Shopify
Nobody has claimed this yet.
- Dominant language
- AL
- Stars
- 683
- Forks
- 459
- Avg merge
- 3d 26m
- Merged PRs (30d)
- 633
Description
Describe the issue
When a product is imported from Shopify (Sync Item = From Shopify) and the shop is later switched to To Shopify, product sync may create productVariantsBulkCreate mutations using optionName: "Variant" instead of the product's actual Shopify option name (e.g. Size). Shopify rejects the mutation, the new BC item variants are never created in Shopify, and BC logs:
The response from Shopify contains no JSON
This is reproducible in Cronus and not customer-data-specific.
Expected behavior
For existing Shopify products, new variant creation from BC should reuse the product's existing Shopify option name (e.g. Size). Fallback to Variant should only occur when no Shopify option metadata exists (i.e. the product was originally created from BC).
Steps to reproduce
- In Shopify, create a product with option name
Sizeand valueTest. - In BC, set
Sync Item = From Shopifyand run product sync. - Confirm the imported Shopify variant shows
Option 1 Name = Size,Option 1 Value = Test. - Switch the shop to
Sync Item = To Shopify. - Add BC item variants (e.g.
VARIANT 1,VARIANT 2) on the mapped item. - Run product sync (Report 30108).
- Check the job queue log — the outbound payload will show
optionName: "Variant"instead of"Size", and the new variants will not appear in Shopify.
Additional context
-
Repro product ID:
10755490906449 -
Failing payload:
optionValues: [{ optionName: "Variant", name: "VARIANT 2" }] -
Error in BC:
The response from Shopify contains no JSON -
Root cause:
FillInProductVariantDatainShpfyProductExport.Codeunit.alhardcodes'Variant'as option name (lines ~423 and ~476) instead of deriving it from existing Shopify variant metadata for the product. -
Suggested fix: Resolve option name from existing
Shpfy Variantrows for the product before falling back to'Variant'. BC-origin products (where no Shopify option metadata exists) are unaffected. -
I will provide a fix for a bug
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in ShpfyProductExport.Codeunit.al at FillInProductVariantData, especially the locations around lines 423 and 476, and inspect the existing Shpfy Variant rows for the mapped product. Reproduce the case with Report 30108 using an imported Shopify product, then verify the outbound payload preserves its option name and still handles BC-origin products without Shopify option metadata.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100