Woocommerce view order link in customer emails

I am trying to figure out how to add a clickable link in the e-mails to my customers that takes them directly to the view-order page (myurl/my-account/view-order/xxx/).

I have found some code that comes close, but the link doesn’t work when I add it to the email templates.

printf( __( 'Order: %s', 'woocommerce'), '<a href="https://wordpress.stackexchange.com/questions/242612/$order->get_view_order_url()">'. $order->get_order_number() .'</a>' );

I know of a paid plugin that does it, but I am trying to cut down on the use of plugins, especially for something this simple.
This is the plugin: https://codecanyon.net/item/woocommerce-view-order-online-link/6247837

1 Answer
1

Try changing that code to this:

printf( __( 'Order: %s', 'woocommerce'), '<a href="' . $order->get_view_order_url() . '">'. $order->get_order_number() .'</a>' );

Leave a Comment