> For the complete documentation index, see [llms.txt](https://developer.esw.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.esw.com/adobe-commerce-magento/esw-adobe-extension-features/order-fulfillment-package-asn/synchronize-adobe-commerce-shipment-with-esw.md).

# Synchronize Adobe Commerce Shipment with ESW

Synchronize Magento Shipment with ESW" process is when, the Adobe Commerce (Magento) shipment data record is sent to ESW. This type of synchronization can be used in the following scenarios:

* When a retailer integrates with ESW logistics and an ASN (Advanced Shipment Notification) is required in advance, before the shipment arrives at the ESW distribution center.
* When using only ESW checkout, and the ASN is used to initiate the settlement reconciliation process with the retailer for goods sold.

## Setting Up The Package Reference/ID <a href="#setting-up-the-package-reference-id" id="setting-up-the-package-reference-id"></a>

This section applies when the ESW distribution center requires ASN information before the shipment arrives from the retailer warehouse.\
The “package\_reference” for this integration acts as the ID/barcode for ESW to scan at arrival and identify shipped goods; it has to be unique. The extension sends package data to ESW based on the shipment created in Adobe Commerce (Magento). The `package_reference` can be set in different ways:

* By creating shipment using [shipment API](https://developer.adobe.com/commerce/webapi/rest/tutorials/inventory/create-shipment/) with new additional extension attribute: package\_reference&#x20;
* By creating shipment using [shipment API](https://developer.adobe.com/commerce/webapi/rest/tutorials/orders/order-create-shipment/) and includes the track\_number attribute. For this option, the package reference is the courier tracking code label applied during shipment from the retailer's WMS to the ESW distribution center.
* If no `package_reference` or track\_number is set, the order increment ID from Adobe Commerce (Magento) is used as the package reference.

The weight from the Adobe Commerce (Magento) shipment is sent to ESW as part of the package integration. If no weight is set in the shipment, the product weight from the order item is used.

The ESW tracking URL is being added back as a result of synchronization. Thanks to this, the customer can see the tracking URL in their account under the shipping details section.

## Cron synchronization <a href="#cron-synchronization" id="cron-synchronization"></a>

The Cron job is used to send ESW shipment from Adobe Commerce (Magento). A request is sent for each shipment that has the shipment status as Pending. The following table shows the shipment status update based on a response from the ESW Package API:

| Code | Description  | Sync action                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ---- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 204  | Success      | Update record status to Synchronized.                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| 400  | Bad Request  | <p>1001 The invalid model status: Update record status to Error.<br>301 Invalid brand code status: Leave current record status.<br>316 Invalid number of package references status: Update record status to Error.<br>317 Required order references status: Update record status to Error.<br>318 ESW setup error status: Leave current record status.<br>400 Invalid AsnApiRequest error status: Leave current record status.<br>999 General error: Update record status to Error.</p> |
| 401  | Unauthorized | Leave current record status                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| 404  | Not Found    | Leave current record status                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| 409  | Conflict     | 333 Package already exists. Update record status to Synchronized                                                                                                                                                                                                                                                                                                                                                                                                                        |
| 500  | Server Error | Leave current record status                                                                                                                                                                                                                                                                                                                                                                                                                                                             |

## Integration interface <a href="#integration-interface" id="integration-interface"></a>

### Admin Shipments grid <a href="#admin-shipments-grid" id="admin-shipments-grid"></a>

The Action column allows you to push the shipment to ESW manually. The ESW synchronization status column indicates the current shipment status.

### Admin Shipment details <a href="#admin-shipment-details" id="admin-shipment-details"></a>

Allows you to manually change the shipment sync status to any listed status.

### Customer Shipment tracking details <a href="#customer-shipment-tracking-details" id="customer-shipment-tracking-details"></a>

Optional view, depending on the integration. Allows customers to see the tracking URL.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.esw.com/adobe-commerce-magento/esw-adobe-extension-features/order-fulfillment-package-asn/synchronize-adobe-commerce-shipment-with-esw.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
