Skip to content

Conversation

@onbuyuka
Copy link
Contributor

@onbuyuka onbuyuka commented Dec 24, 2025

Summary

This PR adds extensibility for Shopify product metafields, allowing external developers to programmatically manage metafields through a public facade codeunit and integration events.

Problem

External developers cannot programmatically:

  • Retrieve metafield definitions for products/variants
  • Add metafields with values when missing
  • Force-sync metafields to Shopify outside of the standard item sync

Solution

Implemented a public facade pattern (similar to existing Shpfy Product and Shpfy Orders codeunits) for metafield management.

Changes

  • ShpfyMetafields.Codeunit.al - Public facade codeunit with:

    • GetMetafieldDefinitions(ParentTableNo, OwnerId, ShopCode) - Retrieve metafield definitions from Shopify
    • SyncMetafieldToShopify(Metafield, ShopCode): BigInteger - Sync a single metafield to Shopify
    • SyncMetafieldsToShopify(ParentTableNo, OwnerId, ShopCode) - Sync all metafields for a resource
  • ShpfyProductEvents.Codeunit.al

    • Added OnBeforeUpdateProductMetafields(ProductId: BigInteger) integration event
  • ShpfyProductExport.Codeunit.al

    • Raises OnBeforeUpdateProductMetafields event before syncing metafields
    • Refactored to use public facade for metafield operations
  • ShpfyMetafields.Page.al

    • Added "Sync to Shopify" action with multi-select support
    • Refactored to use public facade for all metafield operations
  • ShpfyCustomerExport.Codeunit.al

    • Refactored to use public facade for metafield sync
  • ShpfyCompanyExport.Codeunit.al

    • Refactored to use public facade for metafield sync

Work Item(s)

Fixes AB#617035

@github-actions github-actions bot added the AL: Apps (W1) Add-on apps for W1 label Dec 24, 2025
@github-actions github-actions bot added this to the Version 28.0 milestone Dec 24, 2025
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants