From 2b178a5d6728b7a645779d0586869207b6d8a537 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 22 Mar 2018 14:36:34 -0600 Subject: [PATCH] my-orders add new Woo function Replaces code with "wc_get_account_orders_actions" function; Formatting; Per new Woo template files; --- woocommerce/myaccount/my-orders.php | 33 ++++++----------------------- 1 file changed, 6 insertions(+), 27 deletions(-) diff --git a/woocommerce/myaccount/my-orders.php b/woocommerce/myaccount/my-orders.php index 5b07d4e..271b4a9 100644 --- a/woocommerce/myaccount/my-orders.php +++ b/woocommerce/myaccount/my-orders.php @@ -69,34 +69,13 @@ if ( $customer_orders ) : ?> array( - 'url' => $order->get_checkout_payment_url(), - 'name' => __( 'Pay', 'understrap' ) - ), - 'view' => array( - 'url' => $order->get_view_order_url(), - 'name' => __( 'View', 'understrap' ) - ), - 'cancel' => array( - 'url' => $order->get_cancel_order_url( wc_get_page_permalink( 'myaccount' ) ), - 'name' => __( 'Cancel', 'understrap' ) - ) - ); - - if ( ! $order->needs_payment() ) { - unset( $actions['pay'] ); - } - - if ( ! in_array( $order->get_status(), apply_filters( 'woocommerce_valid_order_statuses_for_cancel', array( 'pending', 'failed' ), $order ) ) ) { - unset( $actions['cancel'] ); - } - - if ( $actions = apply_filters( 'woocommerce_my_account_my_orders_actions', $actions, $order ) ) { - foreach ( $actions as $key => $action ) { - echo '' . esc_html( $action['name'] ) . ''; - } + $actions = wc_get_account_orders_actions( $order ); + + if ( ! empty( $actions ) ) { + foreach ( $actions as $key => $action ) { + echo '' . esc_html( $action['name'] ) . ''; } + } ?>