Changed on:
30 Jan 2024
Fulfilment updates are done at the Order Item level. Where each item can have a specific fulfilment status or multiple items can have the same fulfilment status.
The first stage validates the signature and checks the content has the required parameters. If all goes well, the request is added to the internal message queue to be processed asynchronously otherwise connector will return an error to Fluent to signal that it was unable to accept the request.
The second stage is the actual processing of the webhook message. The message name is key to drive, how the message is going to be processed as these are mapped to internal handlers in commercetools-connector.
Partners utilize the same approach by adding their own handlers and enabling the processing of different messages that are specific to their end goals.
All webhooks carry minimal information and require commercetools-connector to fetch extra details from Fluent in order to complete processing the message received. The diagram below represents the flow executed for an order status update message.
It is possible to override certain parts of the code and extend its functionality. For example, fetching more details from Fluent and either saving it in commercetools or using it to drive extra logic.
Once Fulfilment is created at fluent it sends the webhook with some custom data along with other details like fulfilment status to update the Fulfilment status at commercetools.
Below are the custom fields at commercetools :
Fluent Fulfilment Metadata Fields | Description |
flFulfilment | Fluent Fulfilment Group Key |
flFulfilmentMetadata | Fluent Fulfilment Metadata |
flFulfilmentMetadata.fulfilmentId | Fulfilment Id |
flFulfilmentMetadata.fulfilmentLocationRef | Fulfilment Location Ref |
flFulfilmentMetadata.fulfilmentLocationName | Fulfilment Location Name |
flFulfilmentMetadata.fulfilmentStatus | Fulfilment Status |
flFulfilmentMetadata.fulfilmentQty | Fulfilment Quantity |
flFulfilmentMetadata.ctStatus | commercetools Status |
A custom field label would be the Fluent Fulfilment Metadata, a JSON object type..
Fulfilment line item Status:
This status needs to be mapped against commercetools Line item status.
Order Item Fulfilment:
There could be created a separate entity or custom field to keep order fulfilment status per each order line item. It should be connected to the order line item and keep the line-item fulfilment status.
commercetools Fields | Fluent Fields |
Product SKU | Product Ref |
Line Item State | Fulfilment Status |
Qty | Filled Quantity |
Fulfilment Metadata [{"fulfilmentStatus":"picking","fulfilmentQty":"86","fulfilmentId":"300","fulfilmentLocationRef":"LOC_SYDS"," fulfilmentLocationName":"Sydney Store" }] | Fulfilment Data |
Fulfilment Process Example:
Out-of-the-box(OOTB) two different fulfilment scenarios are supported at the line item level. First will be the basic flow in which a single fulfilment will be mapped against all the quantities requested in the order for a line item and the Second case where there is a quantity split of requested order line item quantity across different fulfilments based on the fulfilment logic.
Once the order is placed fluent system will check if the requested quantity is available. If the requested quantity is not available at a single store, it will split the fulfilment and send the order data with fulfilment details to commercetools. Eg) If quantity X is ordered for product A, then there could be one location ( L1 ) that will fulfil all the requested X quantity or it could get split between two locations ( L1 and L2 ) which will together fulfil the requested line item quantity ( Y + Z = X )
Do note all the above is customizable and configurable as per implementation needs.
As shown in the above snapshot, There are two fulfilments one with id (Fulfilment - 616) for the product “Down jacket “Rapdi“ Peuterey black Gir“ and “Sweater Better Rich grey“. The second fulfilment with id (Fulfilment - 617) will be for only “Sweater Better Rich grey”.
Now the info will be sent to commercetools and in commercetools the fulfilment data will be mapped against the Order item ie. For the product “Sweater Better Rich grey” there will be two fulfilment details. Please refer above snapshot.
1query GetFulfilmentById($fulfilmentId: ID!) {
2 fulfilmentById(id: $fulfilmentId) {
3 id
4 ref
5 status
6 type
7 order {
8 id
9 ref
10 }
11 fromAddress {
12 ref
13 name
14 }
15 items(first: 500) {
16 fulfilmentItemEdges: edges {
17 fulfilmentItemNode: node {
18 id
19 ref
20 status
21 requestedQuantity
22 filledQuantity
23 rejectedQuantity
24 orderItem {
25 id
26 ref
27 product {
28 name
29 }
30 status
31 quantity
32 }
33 }
34 }
35 }
36 }
37}
Language: json
Name: Fulfilment Query
Description:
[Warning: empty required content area]The below payload will be pushed to the internal queue.
1{
2 "id": "c321a113-9307-4269-9a91-a2f99cefe07b",
3 "name": "fc.connect.order.webhook.fulfilment-status-update",
4 "accountId": "CNCTDEV",
5 "retailerId": "1",
6 "rootEntityId": "127",
7 "rootEntityType": "ORDER",
8 "rootEntityRef": "CC_G_FROM_POSTMAN_929",
9 "entityId": "91",
10 "entityRef": "cf45b633-d91a-4eb2-84c9-36495dd3fec3",
11 "entityType": "FULFILMENT",
12 "entityStatus": "AWAITING_WAVE",
13 "type": "NORMAL",
14 "attributes": {}
15}
Language: json
Name: Fulfilment payload
Description:
[Warning: empty required content area]Copyright © 2024 Fluent Retail Pty Ltd (trading as Fluent Commerce). All rights reserved. No materials on this docs.fluentcommerce.com site may be used in any way and/or for any purpose without prior written authorisation from Fluent Commerce. Current customers and partners shall use these materials strictly in accordance with the terms and conditions of their written agreements with Fluent Commerce or its affiliates.