Skip to content

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

@tVisionDeb

Description

@tVisionDeb

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    IntegrationGitHub request for Integration area

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions