woocommerce / woocommerce

A customizable, open-source ecommerce platform built on WordPress. Build any commerce solution you can imagine.
https://woocommerce.com
9.43k stars 10.77k forks source link

Pending payment order not auto canceled for order created_via store-api #51271

Open tchunwei opened 2 months ago

tchunwei commented 2 months ago

Prerequisites

Describe the bug

wc_cancel_unpaid_orders() not canceling order created_via store-api, it only cancel order created_via checkout

Expected behavior

wc_cancel_unpaid_orders() should cancel order created_via store-api (using the new checkout block)

Actual behavior

wc_cancel_unpaid_orders() not canceling order created_via store-api

Steps to reproduce

  1. Use new checkout block, place an order but do not proceed to payment
  2. Wait until hold stock minutes passed, the order stays in Pending Payment status, it should be canceled automatically instead.

WordPress Environment

System Status Report ``` ### WordPress Environment ### WordPress address (URL): [Redacted] Site address (URL): [Redacted] WC Version: 9.1.2 Legacy REST API Package Version: The Legacy REST API plugin is not installed on this site. Action Scheduler Version: ✔ 3.8.1 Log Directory Writable: ✔ WP Version: ❌ 6.6.1 - There is a newer version of WordPress available (6.6.2) WP Multisite: – WP Memory Limit: 1 GB WP Debug Mode: – WP Cron: – Language: en_US External object cache: – ### Server Environment ### Server Info: LiteSpeed PHP Version: 8.3.11 PHP Post Max Size: 512 MB PHP Time Limit: 1000 PHP Max Input Vars: 1000 cURL Version: 7.61.1 OpenSSL/1.1.1k SUHOSIN Installed: – MySQL Version: 10.5.26-MariaDB-cll-lve Max Upload Size: 50 MB Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ GZip: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔ ### Database ### [REDACTED] ### Post Type Counts ### attachment: 215 bsf_custom_fonts: 1 cool_timeline: 1 flamingo_contact: 161 flamingo_inbound: 165 grw_feed: 1 mailpoet_page: 1 oembed_cache: 2 page: 17 post: 38 product: 29 product_variation: 185 product-feed: 1 revision: 42 rm_content_editor: 1 sa_slider: 1 shop_coupon: 51 shop_order_placehold: 101 spectra-popup: 1 wp_global_styles: 2 wp_navigation: 4 wp_template: 9 wp_template_part: 5 wpcf7_contact_form: 1 ### Security ### Secure connection (HTTPS): ✔ Hide errors from visitors: ✔ ### Active Plugins (24) ### Zorem Local Pickup: by zorem – 1.6.6 FiboSearch - AJAX Search for WooCommerce: by FiboSearch Team – 1.28.1 Product Feed Manager for WooCommerce: by RexTheme – 7.4.17 Child Theme Configurator: by Lilaea Media – 2.6.6 Contact Form 7: by Takayuki Miyoshi – 5.9.6 Custom Fonts: by Brainstorm Force – 2.1.5 Login/Signup Popup: by XootiX – 2.7.3 Flamingo: by Takayuki Miyoshi – 2.5 The Icon Block: by Nick Diego – 1.8.0 LiteSpeed Cache: by LiteSpeed Technologies – 6.4.1 MailPoet: by MailPoet – 4.55.0 Members: by MemberPress – 3.2.9 Rank Math SEO: by Rank Math – 1.0.226 Spectra: by Brainstorm Force – 2.14.0 Advanced Shipment Tracking for WooCommerce: by zorem – 3.6.9 Variation Swatches for WooCommerce: by Emran Ahmed – 2.1.1 Google Analytics for WooCommerce: by WooCommerce – 2.1.6 Sequential Order Numbers for WooCommerce: by SkyVerge – 1.10.1 WooCommerce: by Automattic – 9.1.2 (update to version 9.2.3 is available) WooCommerce Fiuu Normal: by Fiuu Tech Team – 3.2.0 WP Crontrol: by John Blackbourn – 1.17.0 WP Mail Logging: by WP Mail Logging Team – 1.12.0 WP Mail SMTP: by WP Mail SMTP – 4.0.1 Widgets for Google Reviews: by Trustindex.io – 12.1.2 ### Inactive Plugins (4) ### Google for WooCommerce: by WooCommerce – 2.8.4 Sequential Order Numbers for WooCommerce: by WebToffee – 1.6.4 Site Kit by Google: by Google – 1.130.0 WooCommerce Razer Merchant Services Normal: by Razer Merchant Services Tech Team – 3.0.8 ### Dropin Plugins () ### maintenance.php: maintenance.php ### Settings ### API Enabled: – Force SSL: – Currency: MYR (RM) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: external (external) grouped (grouped) simple (simple) variable (variable) 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: ✔ HPOS feature enabled: ✔ Order datastore: Automattic\WooCommerce\Internal\DataStores\Orders\OrdersTableDataStore HPOS data sync enabled: – ### Logging ### Enabled: ✔ Handler: Automattic\WooCommerce\Internal\Admin\Logging\LogHandlerFileV2 Retention period: 30 days Level threshold: – Log directory size: 2 KB ### WC Pages ### Shop base: #10 - /shop/ Cart: #11 - /cart/ - Contains the woocommerce/cart block Checkout: #12 - /checkout/ - Contains the woocommerce/checkout block My account: #13 - /my-account/ Terms and conditions: #563 - /terms-and-conditions/ ### Theme ### Name: My Liberica Theme Version: 1.0.1720829362 Author URL: Child Theme: ✔ Parent Theme Name: Twenty Twenty-Four Parent Theme Version: 1.1 – 1.2 is available Parent Theme Author URL: https://wordpress.org WooCommerce Support: ❌ Not declared ### Templates ### Overrides: myliberica/woocommerce/emails/customer-new-account.php myliberica/woocommerce/emails/customer-processing-order.php /home/mingscreative.com/httpdocs/myliberica/wp-content/plugins/easy-login-woocommerce//templates//xoo-el-wc-form-login.php /home/mingscreative.com/httpdocs/myliberica/wp-content/plugins/easy-login-woocommerce//templates//xoo-el-wc-form-login.php /home/mingscreative.com/httpdocs/myliberica/wp-content/plugins/woocommerce/templates/block-notices/error.php /home/mingscreative.com/httpdocs/myliberica/wp-content/plugins/woocommerce/templates/block-notices/notice.php /home/mingscreative.com/httpdocs/myliberica/wp-content/plugins/woocommerce/templates/block-notices/success.php myliberica/woocommerce/single-product/product-attributes.php myliberica/woocommerce/single-product/tabs/additional-information.php myliberica/woocommerce/single-product/tabs/description.php myliberica/woocommerce/single-product-reviews.php ### MailPoet ### Sending Method: SMTP Send all site's emails with: Default WordPress sending method Task Scheduler method: Linux Cron Cron ping URL: https://myliberica.com.my?mailpoet_router&endpoint=cron_daemon&action=ping ### Admin ### Enabled Features: activity-panels analytics product-block-editor coupons core-profiler customize-store customer-effort-score-tracks import-products-task experimental-fashion-sample-products shipping-smart-defaults shipping-setting-tour homescreen marketing mobile-app-banner navigation onboarding onboarding-tasks product-custom-fields remote-inbox-notifications remote-free-extensions payment-gateway-suggestions shipping-label-banner subscriptions store-alerts transient-notices woo-mobile-welcome wc-pay-promotion wc-pay-welcome-page launch-your-store Disabled Features: experimental-blocks minified-js pattern-toolkit-full-composability product-pre-publish-modal printful settings async-product-editor-category-field product-editor-template-system Daily Cron: ✔ Next scheduled: 2024-09-11 02:27:16 +08:00 Options: ✔ Notes: 71 Onboarding: completed ### Action Scheduler ### Complete: 1,023 Oldest: 2024-08-11 00:50:02 +0000 Newest: 2024-09-11 00:42:03 +0000 Failed: 33 Oldest: 2023-12-27 09:28:50 +0000 Newest: 2024-06-12 16:50:35 +0000 Pending: 8 Oldest: 2024-09-11 01:42:03 +0000 Newest: 2024-10-08 00:50:10 +0000 ### Status report information ### Generated at: 2024-09-11 08:45:40 +08:00 ```

Isolating the problem

senadir commented 2 months ago

Thanks! Make sense to add Store API there yeah.