Skip to content

Instantly share code, notes, and snippets.

@monecchi
Forked from claudiosanches/functions.php
Created April 1, 2016 05:37
Show Gist options
  • Save monecchi/8140c8e5def96dc94f741e644f50d49a to your computer and use it in GitHub Desktop.
Save monecchi/8140c8e5def96dc94f741e644f50d49a to your computer and use it in GitHub Desktop.
WooCommerce - Add Order Again button to My Orders actions
<?php
/**
* Add order again button in my orders actions.
*
* @param array $actions
* @param WC_Order $order
* @return array
*/
function cs_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->id ) , 'woocommerce-order_again' ),
'name' => __( 'Order Again', 'woocommerce' )
);
}
return $actions;
}
add_filter( 'woocommerce_my_account_my_orders_actions', 'cs_add_order_again_to_my_orders_actions', 50, 2 );
@Bunlong
Copy link

Bunlong commented Oct 10, 2016

For me it does not work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment