diff --git a/templates/myaccount/my-orders.php b/templates/myaccount/my-orders.php index 40a179b75d4..8b66ecc356f 100644 --- a/templates/myaccount/my-orders.php +++ b/templates/myaccount/my-orders.php @@ -59,23 +59,35 @@ if ( $customer_orders ) : ?> name, 'woocommerce' ) ); ?> - status, array( 'pending', 'failed' ) ) ) : ?> + get_cancel_order_url() ); ?>" class="cancel" title="">() + if ( in_array( $order->status, array( 'pending', 'failed' ) ) ) + $status_actions['cancel'] = array( + 'url' => $order->get_cancel_order_url(), + 'text' => __( 'Cancel', 'woocommerce' ), + 'title' => __( 'Click to cancel this order', 'woocommerce' ), + 'class' => 'cancel' + ); - + $status_actions = apply_filters( 'woocommerce_my_account_my_orders_status_actions', $status_actions, $order ); + + foreach ( $status_actions as $status_action ) { + echo '' . esc_html( $status_action['text'] ) . ''; + } + ?> status, array( 'pending', 'failed' ) ) ) - $actions[] = array( + $actions['pay'] = array( 'url' => $order->get_checkout_payment_url(), 'name' => __( 'Pay', 'woocommerce' ) ); - $actions[] = array( + $actions['view'] = array( 'url' => add_query_arg( 'order', $order->id, get_permalink( woocommerce_get_page_id( 'view_order' ) ) ), 'name' => __( 'View', 'woocommerce' ) ); @@ -83,7 +95,7 @@ if ( $customer_orders ) : ?> $actions = apply_filters( 'woocommerce_my_account_my_orders_actions', $actions, $order ); foreach( $actions as $action ) { - echo '' . esc_html( $action['name'] ) . ''; + echo '' . esc_html( $action['name'] ) . ''; } ?>