Code-Snippets-Functions/Execute a function on a child site/WooCommerce/order-again-my-account-orders.txt

11 lines
469 B
Text

add_filter( 'woocommerce_my_account_my_orders_actions', 'wc_order_again_action', 9999, 2 );
function wc_order_again_action( $actions, $order ) {
if ( $order->has_status( 'completed' ) ) {
$actions['order-again'] = array(
'url' => wp_nonce_url( add_query_arg( 'order_again', $order->get_id(), wc_get_cart_url() ), 'woocommerce-order_again' ),
'name' => __( 'Order again', 'woocommerce' ),
);
}
return $actions;
}