Black Friday & Cyber Monday SUPER SALE ALL WEEK:
Grab 40% OFF on plugins
Days
Hours
Minutes
Seconds

How to Add Product Link in WooCommerce Processing Order Email?

Product links are typically added in various communication channels and touchpoints throughout the customer journey. What if you can extend this convenient feature to order process emails? That is what we are going to see in this post.

This customization of adding product links in processing order emails eases customers to directly navigate from the processing order email to the product page.

Solution: Add Product Link in WooCommerce Processing Order Email

The code snippet will add a product link to all the items present in the processing order email.

add_action( 'woocommerce_email_before_order_table', 'ts_add_product_link_to_order_email', 10, 4 );

function ts_add_product_link_to_order_email( $order, $sent_to_admin, $plain_text, $email ) {
    // Check if it's a processing order email
    if ( $email->id === 'customer_processing_order' ) {
        foreach ( $order->get_items() as $item_id => $item ) {
            $product = $item->get_product();
            $url     = $product ? $product->get_permalink() : '';
            if ( $url ) {
                printf( '<a href="%s">%s</a><br>', esc_url( $url ), $item->get_name() );
            }
        }
    }
}

Output

When an order is set to processing status, the processing order email is sent to the customer, which is a default behavior of WooCommerce. The code tends to add the product links to the processing order emails for the items that are ordered.

Add Product Link in WooCommerce Processing Order Email

We saw how to add product links in processing order emails with the handy code snippets. Do you know you can also how to send customized emails for custom order statuses in WooCommerce? We have made a separate post on this. Sending unique emails for custom order status will help you make more personalized communication with your customers; check it out. 

Browse more in: Code Snippets, WooCommerce How Tos, WooCommerce Tutorials

Share It:

Subscribe
Notify of
0 Comments
Newest
Oldest
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x