Product Icon

WooCommerce Bookings

Allow customers to book appointments, make reservations or rent equipment without leaving your site.

Replace hard-coded status check with $order->needs_payment()

The “pay” button in My Account > Orders is disabled by checking if the order has the status “pending”. This works fine for default Woo behaviour but excludes custom order statuses.

Instead, check if the order needs payment with $order->needs_payment() which returns boolean true/false. The function contains a filter that allows 3rd party plugins to add their own unpaid order statuses with filter “woocommerce_valid_order_statuses_for_payment”.

Use case: 3rd party plugin adds an unpaid order status. With the modification the 3rd party plugin does not need to add further code to remove the Pay button.

Benefit: better integration with 3rd party plugins

Screenshots

Author

devagenturallison

Current Status

Open

Last updated: July 10, 2024

0 comments

Log in to comment on this feature request.

Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.