Skip to content

Instantly share code, notes, and snippets.

@jorpdesigns
Last active July 13, 2021 19:22
Show Gist options
  • Save jorpdesigns/b1a9becaf2d850db666e9ca8c601c23c to your computer and use it in GitHub Desktop.
Save jorpdesigns/b1a9becaf2d850db666e9ca8c601c23c to your computer and use it in GitHub Desktop.
Snippet to add "Order Again" button to WooCommerce order actions
<?php
add_filter( 'woocommerce_my_account_my_orders_actions', 'add_order_again_to_my_orders_actions', 50, 2 );
function add_order_again_to_my_orders_actions( $actions, $order ) {
if ( $order->has_status( 'completed' ) ) {
$actions['order-again'] = array(
'url' => wp_nonce_url( add_query_arg( 'order_again', $order->get_id() ) , 'woocommerce-order_again' ),
'name' => __( 'Order Again', 'woocommerce' )
);
}
return $actions;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment