Skip to content

Conversation

@GediminasGaubys
Copy link
Contributor

@GediminasGaubys GediminasGaubys commented Jan 22, 2026

[Shopify] Item Attributes as Product Options

Summary

This PR introduces support for using Item Attributes as Shopify Product Options. Item Attributes marked with "As Option" in the Shpfy Incl. in Product Sync field are now synchronized to Shopify as Product Options, enabling variant differentiation based on attribute values (e.g., Color, Size, Material).

Note: If "UoM as Variant" is enabled in Shopify Shop settings, Item Attributes as Product Options functionality is bypassed. Enabling "UoM as Variant" fails when "As Option" Item Attributes exist in the system.

Changes

New Functionality:

  • Item Attribute "As Option" designation: Item Attributes can be marked with Shpfy Incl. in Product Sync = "As Option" to indicate they should become Shopify Product Options
  • Export Item Attributes as Options: When exporting Items to Shopify, marked Item Attributes are converted to Product Options with their values
  • Validation for new variants: When adding an Item as a variant to an existing product, the system validates that the Item has all required "As Option" attributes and that the option value combination is unique
  • Shopify 3-option limit enforcement: Items with more than 3 "As Option" attributes are rejected with a skipped entry, respecting Shopify's maximum of 3 product options

Validation Rules:

  • Items missing required "As Option" attributes cannot be added as variants to existing products
  • Duplicate option value combinations are detected and rejected
  • Items with more than 3 "As Option" attributes fail compatibility check
  • Item Variants must have all "As Option" attributes assigned

Tests:

  • Added ShpfyItemAttrAsOptionTest.Codeunit.al (ID 139540) with tests for:
    • UoM as Variant validation when As Option attributes exist
    • Exporting Items without variants and without As Option attributes
    • Adding Items as variants to products without As Option attributes
    • Exporting Items with As Option attributes (creates variants with options)
    • Validation failure when Item is missing required attributes
    • Validation failure when option value combination already exists
    • Successfully adding Item as variant with different attribute values
    • Exporting Items with variants and without As Option attributes
    • Exporting Items with variants and 3 As Option attributes (unique combinations)
    • Exporting Items with duplicate option value combinations (catches faillure)
    • Exporting Items with more than 3 As Option attributes (catches faillure)

Fixes AB#605734

…utes (checks for existing product options and ensuring unique combinations)
@GediminasGaubys GediminasGaubys requested a review from a team as a code owner January 22, 2026 09:05
@github-actions github-actions bot added AL: Apps (W1) Add-on apps for W1 From Fork Pull request is coming from a fork labels Jan 22, 2026
@github-actions
Copy link

Could not find linked issues in the pull request description. Please make sure the pull request description contains a line that contains 'Fixes #' followed by the issue number being fixed. Use that pattern for every issue you want to link.

@github-actions github-actions bot added the Linked Issue is linked to a Azure Boards work item label Jan 22, 2026
@github-actions github-actions bot added this to the Version 28.0 milestone Jan 22, 2026
@JesperSchulz JesperSchulz added the Integration GitHub request for Integration area label Jan 26, 2026
Copy link
Contributor

@onbuyuka onbuyuka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good other than few nits. here's the testing checklist I went through

Test Checklist for PR #6248 - Item Attributes as Product Options

1. Item Attributes Page - New Field Visibility

  • Open Item Attributes page (Search → "Item Attributes")
  • Verify column "Incl. in Product Sync" is visible when Shopify is enabled
  • Verify column is hidden when no Shopify Shop is enabled
  • Verify dropdown options: blank (" ") and "As Option"
  • Set an Item Attribute to "As Option" and save

2. UoM as Variant Validation (Shopify Shop Card)

  • Open Shopify Shops page → Select a shop → Open Shopify Shop Card
  • Ensure "UoM as Variant" is currently OFF
  • Create an Item Attribute marked as "As Option" (via Item Attributes page)
  • Go back to Shopify Shop Card → Try enabling "UoM as Variant" toggle
  • Expected: Error message: "UoM as Variant is unavailable due to existing Item Attributes marked as "As Option"..."
  • Remove the "As Option" from all Item Attributes
  • Retry enabling "UoM as Variant" → Should succeed now

3. Export Item WITHOUT Variants, WITHOUT "As Option" Attributes

  • Create a new Item (no Item Variants)
  • Do NOT assign any Item Attributes marked as "As Option" to this Item
  • Open Item Card → Click Shopify action group → "Add to Shopify"
  • Select a Shopify Shop
  • Expected: Product created in Shopify with default variant (no options)

4. Export Item WITHOUT Variants, WITH 2 "As Option" Attributes

  • Create 2 Item Attributes (e.g., "Color", "Material") → Set both to "As Option"
  • Create a new Item (no Item Variants)
  • Assign both attributes to the Item via Item CardItem tab → Attributes
  • Open Item CardShopify"Add to Shopify"
  • Expected: Product created with 2 Product Options (Color, Material) and 1 variant

5. Export Item WITH Variants, WITH 3 "As Option" Attributes (Unique Combinations)

  • Create 3 Item Attributes (e.g., "Color", "Size", "Material") → Set all to "As Option"
  • Create an Item with 2 Item Variants (via Item CardItemVariants)
  • Assign different attribute value combinations to each variant:
    • Via Item Variants page → Select variant → VariantAttributes
  • Add to Shopify
  • Expected: Product created with 3 options and 2 variants with unique option combinations

6. Export Item WITH Variants - Duplicate Attribute Combinations (Should Fail)

  • Create Item with 2 Variants
  • Assign identical attribute value combinations to both variants
  • Add to Shopify
  • Expected: Item is skipped; Check Shopify Skipped Records page for error about "duplicate item variant attribute value combinations"

7. Export Item WITH More Than 3 "As Option" Attributes (Should Fail)

  • Create 4 Item Attributes → Set all to "As Option"
  • Assign all 4 to an Item
  • Add to Shopify
  • Expected: Item is skipped; Check Shopify Skipped Records for error "maximum of 3 product options"

8. Add Item as Variant to Existing Product (No "As Option" Attributes)

  • Have an existing Shopify product (synced from BC Item without "As Option" attributes)
  • Open Shopify Products page → Select product → Add Item as Variant action
  • Select a different Item (no "As Option" attributes)
  • Expected: Variant created with Option Name = "Variant", Option Value = Item No.

9. Add Item as Variant - Missing Required Attributes (Should Fail)

  • Have a Shopify product with "As Option" attributes (e.g., "Color", "Size")
  • Try adding an Item that is missing one of the required attributes
  • Expected: Error or skipped entry: "cannot be added as a product variant because it does not have required attributes"

10. Add Item as Variant - Duplicate Option Combination (Should Fail)

  • Have a Shopify product with existing variant having Color=Red, Size=Large
  • Try adding another Item with same Color=Red, Size=Large values
  • Expected: Skipped entry: "another variant already has the same option values"

11. Add Item as Variant - Different Option Values (Should Succeed)

  • Have a Shopify product with existing variant having Color=Red, Size=Large
  • Add an Item with Color=Blue, Size=Large (at least one value different)
  • Expected: New variant created successfully with the correct option values

12. Verify Skipped Records Logging

  • For each failure scenario above, navigate to:
    • Shopify Shops → Select shop → RelatedSkipped Records
    • Or search for "Shopify Skipped Records"
  • Verify appropriate error messages are logged with correct Record IDs

13. Sync Products (Background Job)

  • Have multiple items with various "As Option" attribute configurations
  • Run Sync Products from Shopify Shop Card
  • Verify products are created/updated correctly based on attribute configurations
  • Check Skipped Records for any failures

@onbuyuka onbuyuka requested a review from a team as a code owner February 10, 2026 12:58
@onbuyuka onbuyuka enabled auto-merge (squash) February 10, 2026 12:59
onbuyuka
onbuyuka previously approved these changes Feb 10, 2026
onbuyuka
onbuyuka previously approved these changes Feb 10, 2026
AndreiPanko
AndreiPanko previously approved these changes Feb 10, 2026
@onbuyuka onbuyuka dismissed stale reviews from AndreiPanko and themself via 8113745 February 10, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1 From Fork Pull request is coming from a fork Integration GitHub request for Integration area Linked Issue is linked to a Azure Boards work item

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants