Code-Snippets-Functions/Execute a function on a child site/WooCommerce/hide-orders-with-status-pending-payment-on-my-account-page.txt

7 lines
331 B
Text

add_filter( 'woocommerce_my_account_my_orders_query', 'unset_pending_payment_orders_from_my_account', 10, 1 );
function unset_pending_payment_orders_from_my_account( $args ) {
$statuses = wc_get_order_statuses();
unset( $statuses['wc-pending'] );
$args['post_status'] = array_keys( $statuses );
return $args;
}