Stop “Drafts orders” from deleting
-
Hello guys, I have a question.
When store manager changes the status of an order it disappear from list (/wp-admin/edit.php?post_status=wc-checkout-draft&post_type=shop_order) after few days.
Please, I want to know if “drafts orders” get erased automatically after X days? If so, how can I stop this action?
I need that “drafts orders” do not erase from the store.
Thanks in advance
-
Hello,
I am wondering if there is a plugin that is providing a Draft status to orders.
WooCommerce core order statuses can be checked at:
https://woocommerce.com/document/managing-orders/#order-statusesAnd they are:
- Pending payment
- Failed
- Processing
- Completed
- On hold
- Canceled
- Refunded
- Authentication required
Please, I want to know if “drafts orders” get erased automatically after X days? If so, how can I stop this action?
I need that “drafts orders” do not erase from the store.Before moving forward, can you please share a copy of your site’s System Status? You can find it via
WooCommerce > Status
. Select “Get system report” and then “Copy for support”.?And include it in your response.Thanks.
Hello Igor, thank you for replying
Here is the system status:
### WordPress Environment ### WC Version: 6.7.0 REST API Version: ? 6.7.0 WC Blocks Version: ? 7.8.3 Action Scheduler Version: ? 3.4.0 Log Directory Writable: ? WP Version: 6.0.1 WP Multisite: – WP Memory Limit: 4 GB WP Debug Mode: – WP Cron: ? Language: en_US External object cache: – ### Server Environment ### Server Info: LiteSpeed PHP Version: 7.4.30 PHP Post Max Size: 512 MB PHP Time Limit: 420 PHP Max Input Vars: 10000 cURL Version: 7.71.0 OpenSSL/1.1.1p SUHOSIN Installed: – MySQL Version: 5.5.5-10.5.15-MariaDB-cll-lve Max Upload Size: 128 MB Default Timezone is UTC: ? fsockopen/cURL: ? SoapClient: ? DOMDocument: ? GZip: ? Multibyte String: ? Remote Post: ? Remote Get: ? ### Database ### WC Database Version: 6.7.0 WC Database Prefix: wp_ Total Database Size: 22.82MB Database Data Size: 20.08MB Database Index Size: 2.74MB wp_woocommerce_sessions: Data: 1.03MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_order_itemmeta: Data: 0.08MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_shipping_zone_methods: Data: 0.16MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_actions: Data: 0.16MB + Index: 0.19MB + Engine InnoDB wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_logs: Data: 0.13MB + Index: 0.09MB + Engine InnoDB wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_comments: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_commercekit_searches: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_commercekit_swatches_cache_count: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_commercekit_waitlist: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_commercekit_wishlist: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_commercekit_wishlist_items: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_formcraft_3_files: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_formcraft_3_forms: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_formcraft_3_progress: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_formcraft_3_submissions: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_formcraft_3_views: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_options: Data: 5.50MB + Index: 0.27MB + Engine InnoDB wp_postmeta: Data: 0.39MB + Index: 0.14MB + Engine InnoDB wp_posts: Data: 0.25MB + Index: 0.06MB + Engine InnoDB wp_shopmagic_automation_outcome: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_shopmagic_automation_outcome_logs: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_shopmagic_guest: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_shopmagic_guest_meta: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_shopmagic_marketing_lists: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_shopmagic_optin_email: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_tm_taskmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_tm_tasks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_usermeta: Data: 0.11MB + Index: 0.06MB + Engine InnoDB wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wc_admin_notes: Data: 0.05MB + Index: 0.00MB + Engine InnoDB wp_wc_admin_note_actions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_product_attributes_lookup: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_product_download_directories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wfblockediplog: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wfblocks7: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wfconfig: Data: 0.47MB + Index: 0.00MB + Engine InnoDB wp_wfcrawlers: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wffilechanges: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wffilemods: Data: 6.52MB + Index: 0.00MB + Engine InnoDB wp_wfhits: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wfhoover: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wfissues: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_wfknownfilelist: Data: 3.52MB + Index: 0.00MB + Engine InnoDB wp_wflivetraffichuman: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wflocs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wflogins: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wfls_2fa_secrets: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wfls_settings: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wfnotifications: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wfpendingissues: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_wfreversecache: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wfsnipcache: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wfstatus: Data: 0.13MB + Index: 0.11MB + Engine InnoDB wp_wftrafficrates: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_yoast_indexable: Data: 0.08MB + Index: 0.09MB + Engine InnoDB wp_yoast_indexable_hierarchy: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_yoast_migrations: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_yoast_primary_term: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_yoast_seo_links: Data: 0.02MB + Index: 0.03MB + Engine InnoDB ### Post Type Counts ### attachment: 40 customize_changeset: 2 nav_menu_item: 12 page: 11 post: 3 postman_sent_mail: 21 product: 10 seedprod: 1 shop_coupon: 1 shop_order: 17 shopmagic_automation: 1 wc_order_status: 9 whatsapp-accounts: 1 wp_global_styles: 1 yith-wccos-ostatus: 1 ### Security ### Secure connection (HTTPS): ? Hide errors from visitors: ? ### Active Plugins (18) ### All-in-One WP Migration: by ServMask – 7.62 Autoptimize: by Frank Goossens (futtta) – 3.1.0 CommerceGurus Commercekit: by CommerceGurus – 2.0.3.1 Flexible Shipping: by Octolize – 4.13.2 Kirki Customizer Framework: by David Vongries – 4.0.24 Kushki - WooCommerce Payment Gateway: by Kushki – 3.0.0 Loco Translate: by Tim Whitlock – 2.6.2 Odoo for Woocommerce: by OPMC – 2.3 Really Simple SSL: by Really Simple Plugins – 5.3.2 Shipping Locations Pro: by WPExtend – 1.6 ShopMagic for WooCommerce: by WP Desk – 2.37.12 User Role Editor: by Vladimir Garagulya – 4.63 WhatsApp Chat by NinjaTeam: by NinjaTeam – 3.1.7 Checkout Field Editor for WooCommerce: by ThemeHigh – 1.6.1 WooCommerce: by Automattic – 6.7.0 Wordfence Security: by Wordfence – 7.5.11 Yoast SEO: by Team Yoast – 19.3 WPS Hide Login: by WPServeur NicolasKulka wpformation – 1.9.6 ### Inactive Plugins (3) ### Advanced WooCommerce Product Sales Reporting - Statistics & Forecast: by extendWP – 1.6 Akismet Anti-Spam: by Automattic – 4.2.5 WP-Optimize - Clean, Compress, Cache: by David Anderson Ruhani Rabin Team Updraft – 3.2.6 ### Settings ### API Enabled: – Force SSL: ? Currency: PEN (S/) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: external (external) grouped (grouped) simple (simple) variable (variable) woosb (woosb) Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) featured (featured) outofstock (outofstock) rated-1 (rated-1) rated-2 (rated-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5) Connected to WooCommerce.com: – Enforce Approved Product Download Directories: – ### WC Pages ### Shop base: #6 - /tienda/ Cart: #7 - /carrito/ Checkout: #8 - /finalizar-compra/ My account: #9 - /mi-cuenta/ Terms and conditions: #40 - /terminos-y-condiciones/ ### Theme ### Version: 1.2.1 Child Theme: ? Parent Theme Name: Shoptimizer Parent Theme Version: 2.5.4 Parent Theme Author URL: https://www.commercegurus.com/ WooCommerce Support: ? ### Templates ### Overrides: shoptimizer-child-theme/woocommerce/cart/cart-empty.php shoptimizer-child-theme/woocommerce/cart/cart-item-data.php shoptimizer-child-theme/woocommerce/cart/cart-shipping.php shoptimizer-child-theme/woocommerce/cart/cart-totals.php shoptimizer-child-theme/woocommerce/cart/cart.php shoptimizer-child-theme/woocommerce/cart/cross-sells.php shoptimizer-child-theme/woocommerce/cart/mini-cart.php shoptimizer-child-theme/woocommerce/cart/proceed-to-checkout-button.php shoptimizer-child-theme/woocommerce/cart/shipping-calculator.php shoptimizer-child-theme/woocommerce/checkout/cart-errors.php shoptimizer-child-theme/woocommerce/checkout/form-billing.php shoptimizer-child-theme/woocommerce/checkout/form-checkout.php shoptimizer-child-theme/woocommerce/checkout/form-coupon.php shoptimizer-child-theme/woocommerce/checkout/form-login.php shoptimizer-child-theme/woocommerce/checkout/form-pay.php shoptimizer-child-theme/woocommerce/checkout/form-shipping.php shoptimizer-child-theme/woocommerce/checkout/order-receipt.php shoptimizer-child-theme/woocommerce/checkout/payment-method.php shoptimizer-child-theme/woocommerce/checkout/payment.php shoptimizer-child-theme/woocommerce/checkout/review-order.php shoptimizer-child-theme/woocommerce/checkout/terms.php shoptimizer-child-theme/woocommerce/checkout/thankyou.php shoptimizer-child-theme/woocommerce/emails/customer-on-hold-order.php ### Admin ### Enabled Features: activity-panels analytics coupons customer-effort-score-tracks experimental-products-task experimental-import-products-task experimental-fashion-sample-products experimental-product-tour homescreen marketing mobile-app-banner navigation onboarding onboarding-tasks remote-inbox-notifications remote-free-extensions payment-gateway-suggestions shipping-label-banner subscriptions store-alerts transient-notices wc-pay-promotion wc-pay-welcome-page wc-pay-subscriptions-page Disabled Features: minified-js settings Daily Cron: ? Next scheduled: 2022-07-26 15:25:17 -05:00 Options: ? Notes: 62 Onboarding: completed ### Action Scheduler ### Complete: 449 Oldest: 2022-07-13 16:51:48 +0000 Newest: 2022-07-26 01:57:01 +0000 Pending: 2 Oldest: 2022-07-26 03:33:06 +0000 Newest: 2022-08-01 19:08:17 +0000 ### Status report information ### Generated at: 2022-07-25 20:58:07 -05:00
`
After searching I found this: https://developer.woocommerce.com/2020/11/23/introducing-a-new-order-status-checkout-draft/
It says: “there is a scheduled clean-up action that will automatically delete Checkout Drafts every 24 hours.”
Please, how can I stop this action to take place? I really need to keep the drafts orders.
Thanks in advance
-
This reply was modified 2 years, 4 months ago by
Skus.
Hi @skus
Thanks for sharing the System Status Report, and the article.
The
checkout-draft
status of orders is being generated for you because your site has the WooCommerce Blocks feature-plugin active and is using the Cart and Checkout blocks. You may have noticed it here.I searched around but couldn’t find a way to stop those drafts from getting deleted. But this could probably be achieved from a development perspective. You can reach out at the following places for development-oriented questions:
- WooCommerce Developer Resources Portal: https://developer.woocommerce.com/
- WooCommerce Slack Community: https://woocommerce.com/community-slack/
- WooCommerce Community on Facebook: https://www.facebook.com/groups/advanced.woocommerce/
You may also be able to find someone willing to volunteer their time and knowledge in the free PHP support forum at PHP Builder.
For direct assistance with customization or development with your site, we recommend reaching out to someone on our customizations page.
WC Blocks Version: ? 7.8.3
– I noticed that an outdated version of WooCommerce Blocks is in use on the site, so please update it to the latest available version (8.1.0).Hello @margaretwporg & @ihereira thanks for your help.
I manage to solve this by myself, I explain my “solution” if anyone needs to achieve the same.
First I’ve change file “DraftOrders.php” locate on plugins/woocommerce/packages/woocommerce-blocks/src/Domain/Services by removing when it creates the add_action “woocommerce_cleanup_draft_orders”, then increasing the time limite (1 DECADE) and change to false line 176 ($order->delete( false );).
Then I was able to remove the schedule action on wp-admin/admin.php?page=wc-status&tab=action-scheduler&status=pending
The event I’ve needed to erase/stop was always mark as pending (I’ve couldn’t delete before), now I’ve delete it so it won’t happen again.
I’ve wait and check that all the drafts still remains after 1 day, so it’s working fine.
I know it’s not the best idea to change the files from plugin, but I really need it a solution.
Hope you can improve this on future updates so users can delete directly events and not change core files.
Thanks for you help
Hi @skus
Thank you for sharing the solution. I’m marking this thread as resolved now. If you have a few minutes, we’d love if you could leave us a review: https://www.ads-software.com/support/plugin/woocommerce/reviews/
Hope you can improve this on future updates so users can delete directly events and not change core files.
Just to add, you can submit a feature request like this on the following page:
https://woocommerce.com/feature-requests/woocommerce-gutenberg-products-block/Thanks a bunch. That was very kind of you. I just did not have the time / energy to chase that one down.
The simpler solution is to comment out line 47 in the DraftOrders.php file.One could possibly write a small plugin, or place the code in your theme’s functions.php file to remove_action(). That would avoid the need to edit the plugin files directly. I don’t need to do this permanently though, so haven’t written and/or tested that.
To plugin support:
This is very poor UI/UX. Changing the status to draft is available from /wp-admin/, but there is zero warning that some of your orders are just going to be permanently deleted (not even moved to trash).
Thankfully I had a suitable backup, but as soon as I restored it, it would delete the drafts again, before I even had a chance to change their status back to on hold.
I would respectfully suggest not asking for reviews based on this thread, as neither of you provided a suitable solution in this case.
Hi @carike
Thanks a bunch. That was very kind of you. I just did not have the time / energy to chase that one down.
The simpler solution is to comment out line 47 in the DraftOrders.php file.Thanks for sharing your solution with the community.
To plugin support:
This is very poor UI/UX. Changing the status to draft is available from /wp-admin/, but there is zero warning that some of your orders are just going to be permanently deleted (not even moved to trash).
Thankfully I had a suitable backup, but as soon as I restored it, it would delete the drafts again, before I even had a chance to change their status back to on hold.
I totally understand this. You could raise this concern to the Github Repository should you think that this is a bug or more of an enhancement so that our developers could take a deeper look on this concern.
https://github.com/woocommerce/woocommerce/issues
Thanks!
- The topic ‘Stop “Drafts orders” from deleting’ is closed to new replies.