Fulfillment Cancelled Webhook

Solved

Fulfillment Cancelled Webhook

oralunal
Shopify Partner
5 1 1

Hi,

 

I noticed that there are webhooks for fulfillment creation and fulfillment update, but there doesn’t seem to be a webhook for fulfillment cancelled. How can I detect when a fulfillment is cancelled?

 

Is there a recommended approach or workaround to handle this scenario?

 

Thanks for your help!

One day you will eat your last meal, you will smell your last flower, you will hug your friend for the last time. You might not know it's the last time, that's why you must do everything you love with passion.
Accepted Solution (1)
oralunal
Shopify Partner
5 1 1

This is an accepted solution.

I found that the fulfillment/update webhook includes a 'status':'cancelled' field when a fulfillment is canceled. This allows us to track cancellations directly through the update webhook without needing any additional workarounds.

 

Example output (check line 4):

{
  "id": 123456,
  "order_id": 820982911946154508,
  "status": "cancelled",
  "created_at": "2021-12-31T19:00:00-05:00",
  "service": null,
  "updated_at": "2021-12-31T19:00:00-05:00",
  "tracking_company": "UPS",
  "shipment_status": null,
  "location_id": null,
  "origin_address": null,
  "email": "jon@example.com",
  "destination": {
    "first_name": "Steve",
    "address1": "123 Shipping Street",
    "phone": "555-555-SHIP",
    "city": "Shippington",
    "zip": "40003",
    "province": "Kentucky",
    "country": "United States",
    "last_name": "Shipper",
    "address2": null,
    "company": "Shipping Company",
    "latitude": null,
    "longitude": null,
    "name": "Steve Shipper",
    "country_code": "US",
    "province_code": "KY"
  },
  "line_items": [
    {
      "id": 866550311766439020,
      "variant_id": 808950810,
      "title": "IPod Nano - 8GB",
      "quantity": 1,
      "sku": "IPOD2008PINK",
      "variant_title": null,
      "vendor": null,
      "fulfillment_service": "manual",
      "product_id": 632910392,
      "requires_shipping": true,
      "taxable": true,
      "gift_card": false,
      "name": "IPod Nano - 8GB",
      "variant_inventory_management": "shopify",
      "properties": [

      ],
      "product_exists": true,
      "fulfillable_quantity": 1,
      "grams": 567,
      "price": "199.00",
      "total_discount": "0.00",
      "fulfillment_status": null,
      "price_set": {
        "shop_money": {
          "amount": "199.00",
          "currency_code": "USD"
        },
        "presentment_money": {
          "amount": "199.00",
          "currency_code": "USD"
        }
      },
      "total_discount_set": {
        "shop_money": {
          "amount": "0.00",
          "currency_code": "USD"
        },
        "presentment_money": {
          "amount": "0.00",
          "currency_code": "USD"
        }
      },
      "discount_allocations": [

      ],
      "duties": [

      ],
      "admin_graphql_api_id": "gid://shopify/LineItem/866550311766439020",
      "tax_lines": [

      ]
    },
    {
      "id": 141249953214522974,
      "variant_id": 808950810,
      "title": "IPod Nano - 8GB",
      "quantity": 1,
      "sku": "IPOD2008PINK",
      "variant_title": null,
      "vendor": null,
      "fulfillment_service": "manual",
      "product_id": 632910392,
      "requires_shipping": true,
      "taxable": true,
      "gift_card": false,
      "name": "IPod Nano - 8GB",
      "variant_inventory_management": "shopify",
      "properties": [

      ],
      "product_exists": true,
      "fulfillable_quantity": 1,
      "grams": 567,
      "price": "199.00",
      "total_discount": "5.00",
      "fulfillment_status": null,
      "price_set": {
        "shop_money": {
          "amount": "199.00",
          "currency_code": "USD"
        },
        "presentment_money": {
          "amount": "199.00",
          "currency_code": "USD"
        }
      },
      "total_discount_set": {
        "shop_money": {
          "amount": "5.00",
          "currency_code": "USD"
        },
        "presentment_money": {
          "amount": "5.00",
          "currency_code": "USD"
        }
      },
      "discount_allocations": [
        {
          "amount": "5.00",
          "discount_application_index": 0,
          "amount_set": {
            "shop_money": {
              "amount": "5.00",
              "currency_code": "USD"
            },
            "presentment_money": {
              "amount": "5.00",
              "currency_code": "USD"
            }
          }
        },
        {
          "amount": "5.00",
          "discount_application_index": 2,
          "amount_set": {
            "shop_money": {
              "amount": "5.00",
              "currency_code": "USD"
            },
            "presentment_money": {
              "amount": "5.00",
              "currency_code": "USD"
            }
          }
        }
      ],
      "duties": [

      ],
      "admin_graphql_api_id": "gid://shopify/LineItem/141249953214522974",
      "tax_lines": [

      ]
    }
  ],
  "tracking_number": "1z827wk74630",
  "tracking_numbers": [
    "1z827wk74630"
  ],
  "tracking_url": "https://www.ups.com/WebTracking?loc=en_US&requester=ST&trackNums=1z827wk74630",
  "tracking_urls": [
    "https://www.ups.com/WebTracking?loc=en_US&requester=ST&trackNums=1z827wk74630"
  ],
  "receipt": {
  },
  "name": "#9999.1",
  "admin_graphql_api_id": "gid://shopify/Fulfillment/123456"
}

 

 

One day you will eat your last meal, you will smell your last flower, you will hug your friend for the last time. You might not know it's the last time, that's why you must do everything you love with passion.

View solution in original post

Replies 2 (2)
oralunal
Shopify Partner
5 1 1

The first method you suggested was actually the approach I was planning to implement, but I was curious if there was a simpler solution. Having a dedicated webhook for cancellations would have made the process much simpler to manage. Thanks for the response!

One day you will eat your last meal, you will smell your last flower, you will hug your friend for the last time. You might not know it's the last time, that's why you must do everything you love with passion.
oralunal
Shopify Partner
5 1 1

This is an accepted solution.

I found that the fulfillment/update webhook includes a 'status':'cancelled' field when a fulfillment is canceled. This allows us to track cancellations directly through the update webhook without needing any additional workarounds.

 

Example output (check line 4):

{
  "id": 123456,
  "order_id": 820982911946154508,
  "status": "cancelled",
  "created_at": "2021-12-31T19:00:00-05:00",
  "service": null,
  "updated_at": "2021-12-31T19:00:00-05:00",
  "tracking_company": "UPS",
  "shipment_status": null,
  "location_id": null,
  "origin_address": null,
  "email": "jon@example.com",
  "destination": {
    "first_name": "Steve",
    "address1": "123 Shipping Street",
    "phone": "555-555-SHIP",
    "city": "Shippington",
    "zip": "40003",
    "province": "Kentucky",
    "country": "United States",
    "last_name": "Shipper",
    "address2": null,
    "company": "Shipping Company",
    "latitude": null,
    "longitude": null,
    "name": "Steve Shipper",
    "country_code": "US",
    "province_code": "KY"
  },
  "line_items": [
    {
      "id": 866550311766439020,
      "variant_id": 808950810,
      "title": "IPod Nano - 8GB",
      "quantity": 1,
      "sku": "IPOD2008PINK",
      "variant_title": null,
      "vendor": null,
      "fulfillment_service": "manual",
      "product_id": 632910392,
      "requires_shipping": true,
      "taxable": true,
      "gift_card": false,
      "name": "IPod Nano - 8GB",
      "variant_inventory_management": "shopify",
      "properties": [

      ],
      "product_exists": true,
      "fulfillable_quantity": 1,
      "grams": 567,
      "price": "199.00",
      "total_discount": "0.00",
      "fulfillment_status": null,
      "price_set": {
        "shop_money": {
          "amount": "199.00",
          "currency_code": "USD"
        },
        "presentment_money": {
          "amount": "199.00",
          "currency_code": "USD"
        }
      },
      "total_discount_set": {
        "shop_money": {
          "amount": "0.00",
          "currency_code": "USD"
        },
        "presentment_money": {
          "amount": "0.00",
          "currency_code": "USD"
        }
      },
      "discount_allocations": [

      ],
      "duties": [

      ],
      "admin_graphql_api_id": "gid://shopify/LineItem/866550311766439020",
      "tax_lines": [

      ]
    },
    {
      "id": 141249953214522974,
      "variant_id": 808950810,
      "title": "IPod Nano - 8GB",
      "quantity": 1,
      "sku": "IPOD2008PINK",
      "variant_title": null,
      "vendor": null,
      "fulfillment_service": "manual",
      "product_id": 632910392,
      "requires_shipping": true,
      "taxable": true,
      "gift_card": false,
      "name": "IPod Nano - 8GB",
      "variant_inventory_management": "shopify",
      "properties": [

      ],
      "product_exists": true,
      "fulfillable_quantity": 1,
      "grams": 567,
      "price": "199.00",
      "total_discount": "5.00",
      "fulfillment_status": null,
      "price_set": {
        "shop_money": {
          "amount": "199.00",
          "currency_code": "USD"
        },
        "presentment_money": {
          "amount": "199.00",
          "currency_code": "USD"
        }
      },
      "total_discount_set": {
        "shop_money": {
          "amount": "5.00",
          "currency_code": "USD"
        },
        "presentment_money": {
          "amount": "5.00",
          "currency_code": "USD"
        }
      },
      "discount_allocations": [
        {
          "amount": "5.00",
          "discount_application_index": 0,
          "amount_set": {
            "shop_money": {
              "amount": "5.00",
              "currency_code": "USD"
            },
            "presentment_money": {
              "amount": "5.00",
              "currency_code": "USD"
            }
          }
        },
        {
          "amount": "5.00",
          "discount_application_index": 2,
          "amount_set": {
            "shop_money": {
              "amount": "5.00",
              "currency_code": "USD"
            },
            "presentment_money": {
              "amount": "5.00",
              "currency_code": "USD"
            }
          }
        }
      ],
      "duties": [

      ],
      "admin_graphql_api_id": "gid://shopify/LineItem/141249953214522974",
      "tax_lines": [

      ]
    }
  ],
  "tracking_number": "1z827wk74630",
  "tracking_numbers": [
    "1z827wk74630"
  ],
  "tracking_url": "https://www.ups.com/WebTracking?loc=en_US&requester=ST&trackNums=1z827wk74630",
  "tracking_urls": [
    "https://www.ups.com/WebTracking?loc=en_US&requester=ST&trackNums=1z827wk74630"
  ],
  "receipt": {
  },
  "name": "#9999.1",
  "admin_graphql_api_id": "gid://shopify/Fulfillment/123456"
}

 

 

One day you will eat your last meal, you will smell your last flower, you will hug your friend for the last time. You might not know it's the last time, that's why you must do everything you love with passion.