Skip to content

Conversation

@onbuyuka
Copy link
Contributor

@onbuyuka onbuyuka commented Jan 21, 2026

Shopify API 2026-01 Upgrade

Summary

This PR upgrades the Shopify Connector to API version 2026-01, addressing deprecations, new features, and breaking changes announced in the Shopify changelog.

Changes

Inventory Sync (Breaking Change)

  • Mutation upgrade: Replaced deprecated inventorySetOnHandQuantities with inventorySetQuantities using name: "on_hand" and reason: "correction"
  • Idempotency support: Added @idempotent(key: "...") directive to inventory mutations for safe retries
  • Concurrency handling: Added changeFromQuantity: null to opt-out of compare-and-swap (BC is the authoritative source)
  • Retry logic: Auto-retry once on IDEMPOTENCY_CONCURRENT_REQUEST or CHANGE_FROM_QUANTITY_STALE errors, then log to skipped records

50,000 Inventory Quantities Limit

  • Added batching logic in AddProductVariants to respect the new limit of 50,000 inventory quantities per mutation
  • GetMaxVariantsPerBatch() calculates max variants based on 50000 div LocationCount
  • Made GetDefaultLocationCount() and GetMaxVariantsPerBatch() internal for testability

Bulk Operations

  • Removed deprecated currentBulkOperation query (now uses GetBulkRequest by ID)
  • Deleted ShpfyGQLBulkOperations.Codeunit.al and removed GetCurrentBulkOperation enum value

Return Reasons

  • Replaced deprecated returnReason enum with returnReasonDefinition { name handle }
  • Added Return Reason Name and Return Reason Handle fields to Shpfy Return Line table
  • Marked old Return Reason enum field as obsolete

Payouts

  • Added externalTraceId field to payout queries and Shpfy Payout table
  • Made ImportPayout() internal for testability

Product Variants

  • Removed deprecated taxCode field from variant queries and mutations
  • Marked Tax Code field as obsolete on Shpfy Variant table and page

Metafields

  • Added article_reference metafield type with ShpfyMtfldTypeArticleRef.Codeunit.al

Test Changes

  • New: ShpfyInventoryExportTest.Codeunit.al - Tests for idempotency, retry logic, and skipped record logging
  • New: ShpfyInventorySubscriber.Codeunit.al - Mock subscriber with configurable retry scenarios
  • New: ShpfyInventoryRetryScenario.Enum.al - Enum for test scenarios (Success, FailOnceThenSucceed, AlwaysFail)
  • New: ShpfyVariantBatchingTest.Codeunit.al - Tests for 50K limit batch calculations
  • Updated: ShpfyOrderRefundsHelper.Codeunit.al - Uses new return reason fields
  • Updated: ShpfyPaymentsTest.Codeunit.al - Added externalTraceId test
  • Updated: ShpfyBulkOpSubscriber.Codeunit.al - Removed obsolete currentBulkOperation handler
  • Deleted: CurrentBulkOperationCompletedResult.txt, CurrentBulkOperationRunningResult.txt

Breaking Changes

  • inventorySetOnHandQuantities mutation replaced - no action required for users
  • returnReason field deprecated - users should reference Return Reason Name instead
  • taxCode field deprecated - users relying on this field should migrate away

References

Fixes AB#617321

@onbuyuka onbuyuka changed the title Shopify API 2026-01 uptake [WIP][Shopify] API 2026-01 uptake Jan 21, 2026
@github-actions github-actions bot added the AL: Apps (W1) Add-on apps for W1 label Jan 21, 2026
@github-actions github-actions bot added this to the Version 28.0 milestone Jan 21, 2026
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