/
Shopify Cancel Order Flow (Deprecated)

Shopify Cancel Order Flow (Deprecated)

**Document below need an Update

Step 1. EshopboxOrdersListener will listen to ShopifyOrdersCancelled (orders/cancelled) Webhook event and will push the data into TaskQueue. Event received from

{ "queueData": { "channelData": { "externalChannelId": "MONTECARLO_PREPROD", "accountSlug": "montecarlo", "connectionId": 52, "location": { "58291847336": "MJPAT_109", "58291912872": "Warehouse" }, "accessToken": "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", "Shopify_workspaceToken_52": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ik1UaERRamxDUlRJelJVUTRRVU0wUVRJNU1FSkVOVGszUVVFeU5qVXdSa1JDTmpBeU16WTROQSJ9.eyJodHRwczovL2FwcERhdGEiOnsiYXBwQ2xpZW50SWQiOiJjN2U1MDU4NGRhMDM4MmFlY2RmMWEzMzQ1OTFmZmQzOCJ9LCJodHRwczovL2FjY291bnRTbHVnIjoibW9udGVjYXJsbyIsImh0dHBzOi8vdXNlckRldGFpbHMiOnsiaWQiOjgwOCwidXNlclR5cGUiOiJkZWZhdWx0IiwiZW1haWwiOiJhcHB1c2VyMjFAZXNob3Bib3guY29tIn0sImh0dHBzOi8vYWNjb3VudHMiOlsibW9udGVjYXJsbyJdLCJodHRwczovL3dhcmVob3VzZXMiOltdLCJodHRwczovL3BhcnRuZXJzIjpbXSwiaXNzIjoiaHR0cHM6Ly9lc2hvcGJveC5hdXRoMC5jb20vIiwic3ViIjoiYXV0aDB8NWZlNDdkZjFhNGZhNmMwMDZmMTBjN2I2IiwiYXVkIjoiaHR0cHM6Ly93bXMubXllc2hvcGJveC5jb20iLCJpYXQiOjE2MDkxNTkxNjYsImV4cCI6MTYxMTc1MTE2NiwiYXpwIjoiUXpWTzdmSGsySFl4Mlk1YjNXRG9pRHVHZTR2Q3dqSFAiLCJzY29wZSI6InJlYWQ6b3JkZXJzIG9mZmxpbmVfYWNjZXNzIiwiZ3R5IjoicGFzc3dvcmQifQ.WIdaENzdkYY90VRv-9AEGwreD66tvGaOBug-9G5erhDvboihXpRevDFe1gZTfJdA-HYWOFadw8bqjoM8ZtUv0pJdOI2QA-rKRhfAAaZOdfZc9Tn3DhybZHT4Pmltthz4Cgz-T516F0CTj0VhcR-T-FGg6-qb1xtPB83lflLAa-Lrj7T3FRqA9yp2r9MLCEkBCzqlrKUpCvdeA5DFaCAb-J8gvPsf9rs9pu6lf2Y_1P1fNETZUk2wZ6tGAt0gQnga6zCkoYZ_Su9FseuRx6rq-1IHeSvvbWUcNkvkZN2X91eAqjSNzK7WtCs0ZATpR9m08bFuFO4XascGfptJnfxb5Q" }, "fulfillmentOrder": { "fulfillment_orders": [ { "request_status": "unsubmitted", "shop_id": 50596315304, "fulfillment_service_handle": "manual", "id": 3052423315624, "assigned_location_id": 58291847336, "line_items": [ { "fulfillment_order_id": 3052423315624, "shop_id": 50596315304, "quantity": 1, "line_item_id": 7432141209768, "fulfillable_quantity": 1, "variant_id": 37553403035816, "inventory_item_id": 39683273883816, "id": 8336167567528 }, { "fulfillment_order_id": 3052423315624, "shop_id": 50596315304, "quantity": 2, "line_item_id": 7432141242536, "fulfillable_quantity": 2, "variant_id": 37553403068584, "inventory_item_id": 39683273916584, "id": 8336167600296 } ], "order_id": 3325933748392, "supported_actions": [ "create_fulfillment" ], "assigned_location": { "zip": "122016", "country_code": "IN", "province": "HR", "address2": "gurgaon", "city": "gurgaon", "phone": "", "address1": "gurgaon", "name": "Eshopbox Fulfillment Centre", "location_id": 58291847336 }, "merchant_requests": [], "status": "open" } ] }, "orderDetail": { "total_price_usd": "39.15", "line_items": [ { "variant_title": "32", "total_discount": "0.00", "gift_card": false, "requires_shipping": true, "total_discount_set": { "shop_money": { "amount": "0.00", "currency_code": "INR" }, "presentment_money": { "amount": "0.00", "currency_code": "INR" } }, "title": "1stJan2021Brandstore", "product_exists": true, "variant_id": 37553401233576, "tax_lines": [ { "rate": 0.09, "price": "95.82", "title": "CGST", "price_set": { "shop_money": { "amount": "95.82", "currency_code": "INR" }, "presentment_money": { "amount": "95.82", "currency_code": "INR" } } } ], "vendor": "teststore-eshopbox", "price": "599.00", "product_id": 6169463849128, "id": 7432141177000, "sku": "WVEV", "grams": 0, "quantity": 2, "fulfillable_quantity": 2, "fulfillment_service": "manual", "taxable": true, "variant_inventory_management": "shopify", "discount_allocations": [ { "amount": "133.36", "discount_application_index": 0, "amount_set": { "shop_money": { "amount": "133.36", "currency_code": "INR" }, "presentment_money": { "amount": "133.36", "currency_code": "INR" } } } ], "admin_graphql_api_id": "gid://shopify/LineItem/7432141177000", "name": "1stJan2021Brandstore - 32", "price_set": { "shop_money": { "amount": "599.00", "currency_code": "INR" }, "presentment_money": { "amount": "599.00", "currency_code": "INR" } }, "properties": [], "duties": [] }, { "variant_title": "34", "total_discount": "0.00", "gift_card": false, "requires_shipping": true, "total_discount_set": { "shop_money": { "amount": "0.00", "currency_code": "INR" }, "presentment_money": { "amount": "0.00", "currency_code": "INR" } }, "title": "1stJan2021EshopFC", "product_exists": true, "variant_id": 37553403035816, "tax_lines": [ { "rate": 0.09, "price": "39.91", "title": "CGST", "price_set": { "shop_money": { "amount": "39.91", "currency_code": "INR" }, "presentment_money": { "amount": "39.91", "currency_code": "INR" } } } ], "vendor": "teststore-eshopbox", "price": "499.00", "product_id": 6169464701096, "id": 7432141209768, "sku": "VEAV-1", "grams": 0, "quantity": 1, "fulfillable_quantity": 1, "fulfillment_service": "manual", "taxable": true, "variant_inventory_management": "shopify", "discount_allocations": [ { "amount": "55.55", "discount_application_index": 0, "amount_set": { "shop_money": { "amount": "55.55", "currency_code": "INR" }, "presentment_money": { "amount": "55.55", "currency_code": "INR" } } } ], "admin_graphql_api_id": "gid://shopify/LineItem/7432141209768", "name": "1stJan2021EshopFC - 34", "price_set": { "shop_money": { "amount": "499.00", "currency_code": "INR" }, "presentment_money": { "amount": "499.00", "currency_code": "INR" } }, "properties": [], "duties": [] }, { "variant_title": "37", "total_discount": "0.00", "gift_card": false, "requires_shipping": true, "total_discount_set": { "shop_money": { "amount": "0.00", "currency_code": "INR" }, "presentment_money": { "amount": "0.00", "currency_code": "INR" } }, "title": "1stJan2021EshopFC", "product_exists": true, "variant_id": 37553403068584, "tax_lines": [ { "rate": 0.09, "price": "79.82", "title": "CGST", "price_set": { "shop_money": { "amount": "79.82", "currency_code": "INR" }, "presentment_money": { "amount": "79.82", "currency_code": "INR" } } } ], "vendor": "teststore-eshopbox", "price": "499.00", "product_id": 6169464701096, "id": 7432141242536, "sku": "VEAV-2", "grams": 0, "quantity": 2, "fulfillable_quantity": 2, "fulfillment_service": "manual", "taxable": true, "variant_inventory_management": "shopify", "discount_allocations": [ { "amount": "111.09", "discount_application_index": 0, "amount_set": { "shop_money": { "amount": "111.09", "currency_code": "INR" }, "presentment_money": { "amount": "111.09", "currency_code": "INR" } } } ], "admin_graphql_api_id": "gid://shopify/LineItem/7432141242536", "name": "1stJan2021EshopFC - 37", "price_set": { "shop_money": { "amount": "499.00", "currency_code": "INR" }, "presentment_money": { "amount": "499.00", "currency_code": "INR" } }, "properties": [], "duties": [] } ], "presentment_currency": "INR", "total_discounts_set": { "shop_money": { "amount": "300.00", "currency_code": "INR" }, "presentment_money": { "amount": "300.00", "currency_code": "INR" } }, "location_id": 58291912872, "number": 41, "tax_lines": [ { "rate": 0.09, "price": "215.55", "title": "CGST", "price_set": { "shop_money": { "amount": "215.55", "currency_code": "INR" }, "presentment_money": { "amount": "215.55", "currency_code": "INR" } } } ], "id": 3325933748392, "app_id": 1354745, "subtotal_price": "2395.00", "order_status_url": "https://teststore-eshopbox.myshopify.com/50596315304/orders/38a7c89d05d24897f957fc9e3dab0cc9/authenticate?key\u003d64446d6c144b9bdfa56e8e7d9123396f", "test": false, "total_shipping_price_set": { "shop_money": { "amount": "250.00", "currency_code": "INR" }, "presentment_money": { "amount": "250.00", "currency_code": "INR" } }, "subtotal_price_set": { "shop_money": { "amount": "2395.00", "currency_code": "INR" }, "presentment_money": { "amount": "2395.00", "currency_code": "INR" } }, "payment_gateway_names": [ "manual" ], "total_tax": "215.55", "tags": "", "processing_method": "manual", "shipping_lines": [ { "code": "custom", "tax_lines": [], "price": "250.00", "id": 2751498125480, "source": "shopify", "title": "Custom", "price_set": { "shop_money": { "amount": "250.00", "currency_code": "INR" }, "presentment_money": { "amount": "250.00", "currency_code": "INR" } }, "discount_allocations": [], "discounted_price_set": { "shop_money": { "amount": "250.00", "currency_code": "INR" }, "presentment_money": { "amount": "250.00", "currency_code": "INR" } }, "discounted_price": "250.00" } ], "user_id": 66248900776, "note_attributes": [], "name": "#1041", "connectionId": "52", "total_tax_set": { "shop_money": { "amount": "215.55", "currency_code": "INR" }, "presentment_money": { "amount": "215.55", "currency_code": "INR" } }, "discount_codes": [ { "amount": "300.00", "code": "Custom discount", "type": "fixed_amount" } ], "note": "", "order_number": 1041, "discount_applications": [ { "allocation_method": "across", "value_type": "fixed_amount", "target_type": "line_item", "target_selection": "all", "description": "Custom discount", "type": "manual", "title": "Custom discount", "value": "300.0" } ], "created_at": "2021-01-04T07:33:12-05:00", "total_line_items_price_set": { "shop_money": { "amount": "2695.00", "currency_code": "INR" }, "presentment_money": { "amount": "2695.00", "currency_code": "INR" } }, "taxes_included": false, "buyer_accepts_marketing": false, "confirmed": true, "total_weight": 0, "refunds": [], "total_discounts": "300.00", "fulfillments": [], "updated_at": "2021-01-04T07:33:13-05:00", "processed_at": "2021-01-04T07:33:12-05:00", "currency": "INR", "email": "", "source_name": "shopify_draft_order", "total_price_set": { "shop_money": { "amount": "2860.55", "currency_code": "INR" }, "presentment_money": { "amount": "2860.55", "currency_code": "INR" } }, "billing_address": { "first_name": "Bob", "address1": "123 Billing Street", "phone": "555-555-BILL", "city": "Billtown", "zip": "K2P0B0", "province": "Kentucky", "country": "United States", "last_name": "Biller", "address2": null, "company": "My Company", "latitude": null, "longitude": null, "name": "Bob Biller", "country_code": "US", "province_code": "KY" }, "shipping_address": { "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" }, "customer": { "id": 115310627314723954, "email": "john@test.com", "accepts_marketing": false, "created_at": null, "updated_at": null, "first_name": "John", "last_name": "Smith", "orders_count": 0, "state": "disabled", "total_spent": "0.00", "last_order_id": null, "note": null, "verified_email": true, "multipass_identifier": null, "tax_exempt": false, "phone": null, "tags": "", "last_order_name": null, "currency": "USD", "accepts_marketing_updated_at": null, "marketing_opt_in_level": null, "admin_graphql_api_id": "gid:\/\/shopify\/Customer\/115310627314723954", "default_address": { "id": 715243470612851245, "customer_id": 115310627314723954, "first_name": null, "last_name": null, "company": null, "address1": "123 Elm St.", "address2": null, "city": "Ottawa", "province": "Ontario", "country": "Canada", "zip": "K2H7A8", "phone": "123-123-1234", "name": "", "province_code": "ON", "country_code": "CA", "country_name": "Canada", "default": true } }, "total_price": "2860.55", "total_line_items_price": "2695.00", "total_tip_received": "0.0", "token": "38a7c89d05d24897f957fc9e3dab0cc9", "financial_status": "paid", "admin_graphql_api_id": "gid://shopify/Order/3325933748392", "gateway": "manual" } } }

Step 2. Now listen from TaskQueue and Send the data for Transformation as per the Request Body of WMS Cancel Order

WMS Cancel Order Keys

Shopify Cancel Order Keys

WMS Cancel Order Keys

Shopify Cancel Order Keys

externalChannelID

connectionChannelObject.externalChannelID

customerOrderNumber

fulfillmentOrder.line_items[].fulfillment_order_id

reason

cancel_reason

cancellationTime

cancelled_at

items[].lineItemSequenceNumber

line_items[].id

items[].itemID

fulfillmentOrder.line_items[].inventory_item_id

items[].quantity

line_items[].quantity

items[].productName

line_items[].name

items[].remark

cancel_reason

Step 3. Now once the transformation is done, Push the transformed data to WMS using Below mentioned POST API & Request Body

WMS Cancel Order API

https://wms.eshopbox.com/api/cancel-order

WMS Cancel Order Request Body:

{ "externalChannelID":"{{connectionChannelObject.externalChannelID}}", "customerOrderNumber":"{{fulfillmentOrder.line_items[].fulfillment_order_id}}", "reason":"{{cancel_reason}}", "cancellationTime": "{{cancelled_at}}", "items": [ { "lineItemSequenceNumber": "{{line_items[].line_item_id}}", "itemID": "{{fulfillmentOrder.line_items[].inventory_item_id}}", "quantity": "{{line_items[].quantity}}", "productName": "{{line_items[].name}}", "remark" :"{{cancel_reason}}" } ] }

Response Body:

{ "WMSResponse": { "result": { "reason": "customer", "vendorOrderNumber": "3244939804866", "externalChannelID": "CH0846", "cancellationTime": "2021-02-11T10:29:17+05:30", "customerOrderNumber": "4418764144834", "is_cod": "1", "items": [ { "itemID": "40125733535938", "quantity": 1, "lineItemSequenceNumber": 9159233110210, "remark": "customer", "lineItemTotal": 236, "productName": "Z" }, { "itemID": "40125733535938", "quantity": 1, "lineItemSequenceNumber": 9159233142978, "remark": "customer", "lineItemTotal": 0, "productName": "Z" } ] }, "status": "SUCCESS" } }

Related content