Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WooCommerce Add Product Link in Processing Order Email

I want to add the product link in the Processing Order email which User receives when order. When an order is placed an Order Email sent, I want to get the product link there when user clicks redirects to the detail product page when clicked. Is there any way, I get the product link or the Product Title would Hyperlink.

THANKS

like image 495
Sohaib Avatar asked Mar 13 '14 10:03

Sohaib


People also ask

How do I add a product link in WooCommerce?

Adding a simple product. Adding a Simple product is similar to writing a post in WordPress. Go to WooCommerce > Products > Add Product. You then have a familiar interface and should immediately feel at home.

How do I customize my order confirmation email in WooCommerce?

To change the subject and content of the email notifications, navigate to WooCommerce > Settings > Email, pick an email you would like to edit then click Manage. In this case, I've picked the Processing Order email to send to my customer to notify them about their order confirmation.

How do I change the completed order email in WooCommerce?

You can customize the emails via your wp-admin > WooCommerce > Settings > Emails. Here you'll find the ability to customize all of the emails that WooCommerce sends both to you as a store admin, and to your customers.


1 Answers

The answer from gunbunnysoulja works great but needs two little updates:

  • get_product needs to be wc_get_product
  • $_product->id needs to be $_product->get_id()

The updated answer is as follows:

add_filter( 'woocommerce_order_item_name', 'display_product_title_as_link', 10, 2 );
function display_product_title_as_link( $item_name, $item ) {

    $_product = wc_get_product( $item['variation_id'] ? $item['variation_id'] : $item['product_id'] );

    $link = get_permalink( $_product->get_id() );

    return '<a href="'. $link .'"  rel="nofollow">'. $item_name .'</a>';
}
like image 107
Jarom Avatar answered Dec 07 '22 18:12

Jarom