Quantcast
Channel: Opinion: Shopify Community - Shopify APIs & SDKs
Viewing all articles
Browse latest Browse all 25503

Shopify API - How does order deletion work? by David

$
0
0

Hello,

I'm a bit confused with "Delete an order" functionality in Shopify and I'd like to have that explained to me if it's possible.

First of all, I've read your documentation, the important thing is this "You can only delete an order that has been cancelled or closed." So, creating and deleting an order directly in Shopify admin works just fine. The confusion (problem?) occurs when I try to delete an order via Shopify API. Basically, I successfully create an order using Shopify API (empty order with one line_item) using JSON from your official documentation:

POST /admin/orders.json

{
  "order": {"line_items": [
      {"variant_id": 447654529,"quantity": 1
      }
    ]
  }
}

To delete it, I'd have to cancel OR close it, right?
So, when I do this

POST /admin/orders/#{id}/cancel.json

that order gets cancelled correctly in Shopify admin. Now comes

DELETE /admin/orders/#{id}.json

and that order is gone from Shopify admin. Interesting thing is that, when I search for that same order by its ID

GET /admin/orders/#{id}.json

I actually get that order instead of empty response or '[errors]' : 'Not Found'. I can only conclude that the order has not really been deleted, although I can't see it anywhere on Shopify admin. (I tried cancelling AND closing the order before deleting it, same thing).

This is GET by ID response of the supposedly deleted order:

{"order": {"buyer_accepts_marketing": false,"cancel_reason": "other","cancelled_at": "2014-11-26T08:20:38-05:00","cart_token": null,"checkout_token": null,"closed_at": "2014-11-26T08:21:55-05:00","confirmed": true,"created_at": "2014-11-26T08:08:41-05:00","currency": "USD","email": "","financial_status": "paid","fulfillment_status": null,"gateway": "","id": 282885919,"landing_site": null,"location_id": null,"name": "#1310","note": null,"number": 310,"processed_at": "2014-11-26T08:08:41-05:00","reference": null,"referring_site": null,"source_identifier": null,"source_name": "224265","source_url": null,"subtotal_price": "199.00","taxes_included": false,"test": false,"token": "e4f98e0a6ebaafa80a39a3a0415b6694","total_discounts": "0.00","total_line_items_price": "199.00","total_price": "199.00","total_price_usd": "199.00","total_tax": "0.00","total_weight": 0,"updated_at": "2014-11-26T08:21:55-05:00","user_id": null,"browser_ip": null,"landing_site_ref": null,"order_number": 1310,"discount_codes": [],"note_attributes": [],"processing_method": "","source": "224265","checkout_id": null,"tax_lines": [],"tags": "","line_items": [
            {"fulfillment_service": "manual","fulfillment_status": null,"gift_card": false,"grams": 0,"id": 510486375,"price": "199.00","product_id": 315834151,"quantity": 1,"requires_shipping": true,"sku": null,"taxable": true,"title": "Test Item","variant_id": 732158011,"variant_title": null,"vendor": null,"name": "Test Item","variant_inventory_management": "shopify","properties": [],"product_exists": true,"fulfillable_quantity": 1,"tax_lines": []
            }
        ],"shipping_lines": [],"fulfillments": [],"refunds": []
    }
}

So, is there any sort of trick behind this? Only soft deletion via Shopify API?

Thanks in advance,

David


Viewing all articles
Browse latest Browse all 25503

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>