microsoft / microsoft/BCApps

[Bug]: Shopify variant create uses wrong option name after initial import from Shopify

Open
#7,724 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Approved Team: Integrations
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

  1. In Shopify, create a product with option name Size and value Test.
  2. In BC, set Sync Item = From Shopify and run product sync.
  3. Confirm the imported Shopify variant shows Option 1 Name = Size, Option 1 Value = Test.
  4. Switch the shop to Sync Item = To Shopify.
  5. Add BC item variants (e.g. VARIANT 1, VARIANT 2) on the mapped item.
  6. Run product sync (Report 30108).
  7. 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: FillInProductVariantData in ShpfyProductExport.Codeunit.al hardcodes '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 Variant rows 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.