Marketplaces / Shopify as Marketplace / ShopifyV2 Technical Scope / Shopify Order Management / Shopify Ship Orders DONE

Shopify Ship Orders DONE ✔

Summary of Changes: (The purpose of this table is to keep traceability and Product team to highlight the things that were changed into the scope, based on comments or discussions)

Version Date Created / Updated Notes
v1.0 Hristiyan First publish

Since The Fulfillment API has been deprecated and replaced with Fulfillment Orders. View change

We need to migrate to the new API and introduce the new way of shipping orders. There are two steps which we need to make.

Get Fulfilment ID

Retrieves a list of fulfillment orders for a specific order. We need to use Orders > Marketplace Order Id and call each order in order to get their fulfilment id. In order to do this we need to use the following request.

API Call:GET /admin/api/2023-01/orders/450789469/fulfillment_orders.json

API Docs: https://shopify.dev/docs/api/admin-rest/2023-01/resources/fulfillmentorder#get-orders-order-id-fulfillment-orders

Sample Response:

{
    "fulfillment_orders": [
        {
            "id": 6191810871511,
            "shop_id": 25718685778,
            "order_id": 5118649008343,
            "assigned_location_id": 32573882450,
            "request_status": "unsubmitted",
            "status": "open",
            "supported_actions": [
                "create_fulfillment",
                "hold"
            ],
            "destination": null,
            "line_items": [
                {
                    "id": 13111524065495,
                    "shop_id": 25718685778,
                    "fulfillment_order_id": 6191810871511,
                    "quantity": 1,
                    "line_item_id": 12882391236823,
                    "inventory_item_id": 45437507010775,
                    "fulfillable_quantity": 1,
                    "variant_id": 43344914284759
                }
            ],
            "fulfill_at": "2023-03-08T17:00:00+02:00",
            "fulfill_by": null,
            "international_duties": null,
            "fulfillment_holds": [
            ],
            "delivery_method": {
                "id": 366751285463,
                "method_type": "shipping",
                "min_delivery_date_time": null,
                "max_delivery_date_time": null
            },
            "created_at": "2023-03-08T17:52:54+02:00",
            "updated_at": "2023-03-08T17:52:54+02:00",
            "assigned_location": {
                "address1": "Горубляне",
                "address2": "Гродно 10",
                "city": "София",
                "country_code": "BG",
                "location_id": 32573882450,
                "name": "Офис",
                "phone": "+359896352803",
                "province": "",
                "zip": "1136"
            },
            "merchant_requests": [
            ]
        }
    ]
}

Mapping:

From the whole payload we need only the first id we are receiving.

Shopify Field Hemi Field Comment
fulfillment_orders
id Orders > Shipping ID

The best case for use is to get this id when we are downloading the order otherwise we will have to have a separate cron which is checking all orders with Hemi status “Ready For Shipping“ and with missing Shipping ID.

Creates a fulfillment for one or many fulfillment orders

Creates a fulfillment for one or many fulfillment orders. The fulfillment orders are associated with the same order and are assigned to the same location.

API Call:POST /admin/api/2023-01/fulfillments.json

API Docs: https://shopify.dev/docs/api/admin-rest/2023-01/resources/fulfillment#post-fulfillments

Body:

{
   "fulfillment":{

      "notify_customer":true,
      "tracking_info":{
         "number":12345,
         "url":"www.test.com",
         "company":"speedy"
      },
      "line_items_by_fulfillment_order":[
         {
            "fulfillment_order_id":6191810871511,
            "fulfillment_order_line_items":[
               {
                  "id":13111524065495,
                  "quantity":1
               }
            ]
         }
      ]
   }
}

Sample Request:

API Call:POST https://store.myshopify.com/admin/api/2023-01/fulfillments.json

{
   "fulfillment":{

      "notify_customer":true,
      "tracking_info":{
         "number":12345,
         "url":"www.test.com",
         "company":"speedy"
      },
      "line_items_by_fulfillment_order":[
         {
            "fulfillment_order_id":6191810871511,
            "fulfillment_order_line_items":[
               {
                  "id":13111524065495,
                  "quantity":1
               }
            ]
         }
      ]
   }
}

Mapping:

Shopify Field Required Hemi Field Comment
fulfillment
notify_customer Yes If we have Account Shopify > Notify Customer = 1 we push “true“
If we have Account Shopify > Notify Customer = 0 we push “false“
tracking_info
number Yes Orders > Shipping Track Number Shall we migrate to order shipment?
url No Orders > Shipping Tracking URL Shall we migrate to order shipment?
company Yes Orders >Shipping Carrier Shall we migrate to order shipment?
line_items_by_fulfillment_order
fulfillment_order_id Yes Orders >Shipping ID
fulfillment_order_line_items
id Yes Product in Order > Item Order Line ID
quantity Yes Product in Order > Quantity

Sample Response: If we receive 201 the body will be

{
    "fulfillment": {
        "id": 4598590603479,
        "order_id": 5118649008343,
        "status": "success",
        "created_at": "2023-03-08T17:54:38+02:00",
        "service": "manual",
        "updated_at": "2023-03-08T17:54:39+02:00",
        "tracking_company": "speedy",
        "shipment_status": null,
        "location_id": 32573882450,
        "origin_address": null,
        "line_items": [
            {
                "id": 12882391236823,
                "variant_id": 43344914284759,
                "title": "Настолна Игра Math Test",
                "quantity": 1,
                "sku": "RT502121572",
                "variant_title": null,
                "vendor": "Raya Toys",
                "fulfillment_service": "manual",
                "product_id": 7804250423511,
                "requires_shipping": true,
                "taxable": true,
                "gift_card": false,
                "name": "Настолна Игра Math Test",
                "variant_inventory_management": "shopify",
                "properties": [
                ],
                "product_exists": true,
                "fulfillable_quantity": 0,
                "grams": 200,
                "price": "13.60",
                "total_discount": "0.00",
                "fulfillment_status": "fulfilled",
                "price_set": {
                    "shop_money": {
                        "amount": "13.60",
                        "currency_code": "BGN"
                    },
                    "presentment_money": {
                        "amount": "13.60",
                        "currency_code": "BGN"
                    }
                },
                "total_discount_set": {
                    "shop_money": {
                        "amount": "0.00",
                        "currency_code": "BGN"
                    },
                    "presentment_money": {
                        "amount": "0.00",
                        "currency_code": "BGN"
                    }
                },
                "discount_allocations": [
                ],
                "duties": [
                ],
                "admin_graphql_api_id": "gid://shopify/LineItem/12882391236823",
                "tax_lines": [
                    {
                        "title": "BG VAT",
                        "price": "2.27",
                        "rate": 0.2,
                        "channel_liable": false,
                        "price_set": {
                            "shop_money": {
                                "amount": "2.27",
                                "currency_code": "BGN"
                            },
                            "presentment_money": {
                                "amount": "2.27",
                                "currency_code": "BGN"
                            }
                        }
                    }
                ]
            }
        ],
        "tracking_number": "12345",
        "tracking_numbers": [
            "12345"
        ],
        "tracking_url": "http://www.test.com",
        "tracking_urls": [
            "http://www.test.com"
        ],
        "receipt": {
        },
        "name": "#3369.1",
        "admin_graphql_api_id": "gid://shopify/Fulfillment/4598590603479"
    }
}

This means we should mark the order as shipped and update the status as shipped.

Is this article helpful?
0 0 0