What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: Can I delete an Abandoned Checkout through the Shopify API?

Can I delete an Abandoned Checkout through the Shopify API?

adrien2
Shopify Partner
15 0 2

Hi!

From the docs, it seems it's impossible as there is no DELETE endpoint for Abandoned Checkout. I'm wondering if there is a 'disguised' way of doing it? For example, could there be a hidden `abandoned_checkout_id` parameter that can be sent upon creating an order with the POST on `/admin/orders`?

My usecase is pretty specific: I'm having abandoned checkouts users complete their checkout through an outside payment gateway. So I'm going to create the Orders myself through the Admin API. I am not using the Checkout API because ultimately I cannot have customers go through the native payment gateways, as I want to subscribe them to recurring plans.

Thanks!

Adrien

Replies 11 (11)

KarlOffenberger
Shopify Partner
1873 184 903

Hi Adrien,

Nope, no hidden way either. You can't delete them via Admin UI either. In Admin UI you can archive an abandoned checkout, effectively closing it. That endpoint isn't public though.

Best wishes!

adrien2
Shopify Partner
15 0 2

Hi Karl, again about this abandoned checkout deletion. You said we cannot delete them via the Admin UI but we should be able to archive them. However I cannot see where this is doable in the Admin UI. Could you point me to the button / page?  I looked on the Abandoned Checkouts pages.

Alex
Shopify Staff
1561 81 343

Hey @adrien2,

 

You should be able to do that like so:

 

 

24-57-zilel-ejp1x

 

Cheers.

Alex | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

adrien2
Shopify Partner
15 0 2

great @Alex thank you very much for your quick and detailed answer. I missed that action button in the list.

 

Have a nice day

 

fedebalderas
Shopify Partner
1 0 0

Hi @adrien2, did you find out a workaround for this approach? I have the same situation.

 

It's a shame that Shopify API doesn't include this feature.

adrien2
Shopify Partner
15 0 2

Hi @fedebalderas! I haven't yet tackled that issue but I'm going to have to at some point for my app. It is too bad indeed, I don't really understand if there is a reason not to have this endpoint in the API.

 

I have the feeling that since it's doable from the GUI backoffice with a few clicks, it must be scriptable somehow. I'll try and inspect the outgoing network requests and replicate them, I don't know how hard it'll be yet but I believe it's got to be doable! I'll let you know when I get to it.

jasperking
Tourist
8 0 10

Any luck on trying to replicate the script the GUI is using? I am making an app that is very similar- using DraftOrders for custom-priced items and want to automate deleting abandoned checkouts. Thanks.

adrien2
Shopify Partner
15 0 2

I haven't gotten down to it yet but should look at it in the coming weeks, I'll let you know!

 

Steve_Robbins
Shopify Partner
11 0 1

I think I found where the endpoint lives, but the "abandoned_checkouts" scope isn't accessible by Apps

curl --location --request POST 'https://upscribe-demo.myshopify.com/admin/checkouts/{token}/close.json' --header 'X-Shopify-Access-Token: xxxx'

{ "errors": "Scope undefined for API access: abandoned_checkouts. Valid scopes: admin_login_tokens, admin_notifications, admin_shop_settings, all_orders, all_subscription_contracts, analytics, analytics_overviews, apps, assigned_fulfillment_orders, banking, billing, capital, cash_tracking, channels, checkout_settings, checkouts, checkouts_vault_tokens, content, customer_payment_methods, customer_tags, customers, delivery, discounts, disputes, domains, draft_orders, fulfillments, gdpr_data_request, gift_card_adjustments, gift_cards, home, images, inventory, kit_skills, legal_policies, locales, locations, marketing_events, media_processing, merchant_managed_fulfillment_orders, meta_tags, mobile_payments, mobile_platform_applications, notifications, online_store, online_store_bot_protection, online_store_navigation, online_store_pages, online_store_preferences, order_edits, orders, own_subscription_contracts, payment_gateways, payment_sessions, payment_settings, physical_receipts, point_of_sale_devices, price_rules, product_engagements, product_inventory, product_listings, product_tags, products, publications, reports, resource_feedbacks, retail_addon_subscriptions, retail_bbpos_merchant, retail_roles, sales_agreements, script_tags, scripts, shipping, shopify_payments, shopify_payments_accounts, shopify_payments_balance_debits, shopify_payments_bank_accounts, shopify_payments_bank_accounts_sensitive, shopify_payments_disputes, shopify_payments_legal_entities, shopify_payments_payouts, shopify_payments_payouts_status, smart_grid, social_network_accounts, subscription_plans, taxes, themes, third_party_fulfillment_orders, tracking_pixels, translations, user_private_data, and users" } 

I would expect a 406 error if it was a non-sense request, but it's a 403 and mentions an undocumented scope.  So the endpoint exists, it's just not open to us for some reason.

dstanimirov
Visitor
3 0 0

Аlso and I can not understand why the abandoned Checkouts can not be deleted.  Why then there is a Webhook - on Checkout deletion? And when triggers?  

What I've found is that 

- Checkout update Webhook contain the cart_token and you can delete the abandoned checkouts from your APP when Checkout update Webhook does not contain that token - eg. it happens only when abandoned checkouts are archived

- you can delete the cart from your APP right after Order Payment Success Webhook

- you can keep the Cart even if the User removes the items, once the user adds new items into Cart - only Cart Update Webhook is executed

- if the user clears the browser cache, and start adding items, Cart Create Webhook is executed, even that same Customer, hopefully, the APP create new Cart again. And of course, there can be one more abandoned checkout

So, to keep your APP updated and to not show to sellers x20 Carts full with items inside 🙂 I will try to track abandoned checkouts based on cart_token 

 

adrien2
Shopify Partner
15 0 2

Thanks for the quick and precise answer Karl! That's too bad, but I'll try and find another way.

All the best