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="$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


Try changing that code to this:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.