How to add “Order again” button on WooCommerce my account page

  • Home
  • How to add “Order again” button on WooCommerce my account page
How to add “Order again” button on WooCommerce my account page

This is a very good effective part to add the “Order Again” option on WooCommerce my account page. When you click on the order tab, you can see the “View” button in the placed order table.

You can add an additional button called “Order Again” that can increase sell 30% and make the profit high.


add_filter( 'woocommerce_my_account_my_orders_actions', 'sefatun_order_again_action', 9999, 2 );
function sefatun_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;
}


Code goes to function.php of your active or child theme. Also, you can use Code Snippet WordPress plugin.

Leave a Reply

Your email address will not be published.