Skip to content

[Shopify] Split fulfillment requests by location#7065

Merged
onbuyuka merged 5 commits intomainfrom
bugs/617896-shopify-fulfillment-multi-location
Mar 17, 2026
Merged

[Shopify] Split fulfillment requests by location#7065
onbuyuka merged 5 commits intomainfrom
bugs/617896-shopify-fulfillment-multi-location

Conversation

@onbuyuka
Copy link
Copy Markdown
Contributor

@onbuyuka onbuyuka commented Mar 10, 2026

Summary

  • Shopify's fulfillmentCreate API requires all fulfillment orders in a single request to belong to the same location. When a shipment spans multiple Shopify locations (e.g. one item split across two warehouses), the connector was combining them into one GraphQL mutation, causing a "All fulfillment orders must be assigned to a single location" error.
  • The fulfillment request builder now groups lines by Shopify Location Id and emits separate mutations per location.
  • Added a new key (Shopify Location Id, Shopify Fulfillment Order Id) to the Fulfillment Order Line table to support the grouping.
  • Extracted BuildFulfillmentQueryStart and FinalizeFulfillmentQuery helper procedures to eliminate duplication.

Fixes AB#617896

🤖 Generated with Claude Code

…ion errors

Shopify's fulfillmentCreate API requires all fulfillment orders in a
single request to belong to the same location. When a shipment spans
multiple Shopify locations, the connector now builds separate GraphQL
mutations per location instead of combining them into one request.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@onbuyuka onbuyuka requested a review from a team as a code owner March 10, 2026 13:35
@github-actions github-actions bot added the AL: Apps (W1) Add-on apps for W1 label Mar 10, 2026
@onbuyuka onbuyuka enabled auto-merge (squash) March 10, 2026 13:36
@github-actions github-actions bot added this to the Version 29.0 milestone Mar 10, 2026
onbuyuka and others added 3 commits March 10, 2026 14:40
…ipped

Move GraphQueryStart initialization inside the loop so it uses the
first non-skipped record's location, not the first record overall.
Previously, if all records for the first location were skipped (assigned
or unfulfillable), the mutation would be built with the wrong location.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use an IsFirstLocation boolean instead of comparing PrevLocationId to
detect the first non-skipped record. The previous approach failed when
Shopify Location Id was 0 (unset), because PrevLocationId was also
initialized to 0, so the condition was never true and
BuildFulfillmentQueryStart was never called.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
darjoo
darjoo previously approved these changes Mar 11, 2026
@onbuyuka onbuyuka force-pushed the bugs/617896-shopify-fulfillment-multi-location branch from b5b5d90 to 16cbfb9 Compare March 12, 2026 10:42
@github-actions
Copy link
Copy Markdown

⚠️ Stale Status Check Deleted

The Pull Request Build workflow run for this PR was older than 72 hours and has been deleted.

📋 Why was it deleted?

Status checks that are too old may no longer reflect the current state of the target branch. To ensure this PR is validated against the latest code and passes up-to-date checks, a fresh build is required.


🔄 How to trigger a new status check:

  1. 📤 Push a new commit to the PR branch, or
  2. 🔁 Close and reopen the PR

This will automatically trigger a new Pull Request Build workflow run.

@onbuyuka onbuyuka closed this Mar 16, 2026
auto-merge was automatically disabled March 16, 2026 09:38

Pull request was closed

@onbuyuka onbuyuka reopened this Mar 16, 2026
@onbuyuka onbuyuka enabled auto-merge (squash) March 16, 2026 12:29
@Groenbech96 Groenbech96 requested a review from Copilot March 16, 2026 14:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Shopify shipment export flow to satisfy fulfillmentCreate’s constraint that each request contains fulfillment orders from a single Shopify location, preventing "All fulfillment orders must be assigned to a single location" failures for split-location shipments.

Changes:

  • Group fulfillment order lines by Shopify Location Id and emit one GraphQL mutation per location.
  • Extracted GraphQL mutation start/finalization into helper procedures to reduce duplication.
  • Added a supporting table key and a new unit test covering multi-location shipments.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/Apps/W1/Shopify/Test/Shipping/ShpfyShippingTest.Codeunit.al Adds a unit test verifying two separate fulfillment requests are generated for two locations.
src/Apps/W1/Shopify/Test/Shipping/ShpfyShippingHelper.Codeunit.al Adds helper procedures to create order/shipment/fulfillment-order test data for multi-location scenarios.
src/Apps/W1/Shopify/App/src/Shipping/Codeunits/ShpfyExportShipments.Codeunit.al Changes request generation to split mutations by location and extracts shared query-building helpers.
src/Apps/W1/Shopify/App/src/Order Fulfillments/Tables/ShpfyFulFillmentOrderLine.Table.al Adds an index to support sorting/grouping fulfillment order lines by location + fulfillment order id.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@onbuyuka onbuyuka merged commit e98ea20 into main Mar 17, 2026
55 of 56 checks passed
@onbuyuka onbuyuka deleted the bugs/617896-shopify-fulfillment-multi-location branch March 17, 2026 17:42
onbuyuka added a commit that referenced this pull request Mar 27, 2026
## Summary
- Shopify's `fulfillmentCreate` API requires all fulfillment orders in a
single request to belong to the same location. When a shipment spans
multiple Shopify locations (e.g. one item split across two warehouses),
the connector was combining them into one GraphQL mutation, causing a
`"All fulfillment orders must be assigned to a single location"` error.
- The fulfillment request builder now groups lines by `Shopify Location
Id` and emits separate mutations per location.
- Added a new key (`Shopify Location Id`, `Shopify Fulfillment Order
Id`) to the Fulfillment Order Line table to support the grouping.
- Extracted `BuildFulfillmentQueryStart` and `FinalizeFulfillmentQuery`
helper procedures to eliminate duplication.

Fixes
[AB#617896](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/617896)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
onbuyuka added a commit that referenced this pull request Mar 27, 2026
## Summary
- Shopify's `fulfillmentCreate` API requires all fulfillment orders in a
single request to belong to the same location. When a shipment spans
multiple Shopify locations (e.g. one item split across two warehouses),
the connector was combining them into one GraphQL mutation, causing a
`"All fulfillment orders must be assigned to a single location"` error.
- The fulfillment request builder now groups lines by `Shopify Location
Id` and emits separate mutations per location.
- Added a new key (`Shopify Location Id`, `Shopify Fulfillment Order
Id`) to the Fulfillment Order Line table to support the grouping.
- Extracted `BuildFulfillmentQueryStart` and `FinalizeFulfillmentQuery`
helper procedures to eliminate duplication.

Fixes
[AB#617896](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/617896)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.

4 participants