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
Open
Last updated: July 10, 2024
0 comments
Log in to comment on this feature request.