API - Fulfill an order after canceling some line items

Highlighted
Shopify Partner
2 0 0

Hi All,

We are trying to partially cancel and order and fulfill the rest, but getting a "Line items are already fulfilled". The scenario is:

  1. Create an order with more than one line item
  2. Mark it as paid
  3. Cancel one of the line items using the cancel endpoint => "financial_status" property moved to "partially_refunded"
  4. Fulfill the rest of the order => 422 error throw

We have been using the fulfillment endpoint for a long time and is working perfectly, but looks like in this scenario there is something wrong.

Could you help me determine what the issue is?

 

An example would be:

REQUEST POST: 

/admin/orders/2546378637400/fulfillments.json?r=5
{
    "fulfillment": {
        "tracking_company": "Shop.com",
        "tracking_number": "1111",
        "tracking_numbers": ["1111"],
        "tracking_urls": [null],
        "line_items": [{
                "price": 0.0,
                "quantity": 1,
                "sku": null,
                "name": null,
                "tax_lines": null,
                "properties": null,
                "origin_location": null,
                "id": "5422444609624"
            }
        ],
        "location_id": "256181",
        "notify_customer": true
    }
}

 RESPONSE: 422

{
    "errors": {
        "base": ["Line items are already fulfilled"]
    }
}

 

0 Likes
Highlighted
Shopify Staff
Shopify Staff
582 70 127

Hey @Matthew10,

If you're using the cancel endpoint before attempting fulfillment, this is the reason you're unable to fulfill the order. Using the cancel endpoint cancels the entire order, even if you only refund/restock some of the items. Once an order is cancelled it can no longer have fulfillments created for it.

If you're looking to refund/restock certain items but still plan to ship other items on an order, you should use the refund endpoint instead of cancel. Once the items are refunded, you can continue to fulfill the order as usual.

JB | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes