I want rating from customers by sending mail after order is completed. If customer will click link on mail for review it should redirect to same current product page of my site.

How do I do this. I override woocommerce/emails in my child theme. I have customized customer-completed-order.php

<div class="rating">
    <h2> Please Rate this product and review. </h2>
    <a href="http://animax.cf/product/happy-ninja/#reviews">
        <img src="https://animax.cf/wp-content/uploads/2015/12/product-reviews.png" alt="Product Rating">
    </a>
</div>

1 Answer
1

WooCommerce default customer-complete-order.php email template does not link the order item to corresponding product. You need to use woocommerce_order_item_name filter and update the item name to have link. I just tried below code and it adds the link to order item (product name). Put this code in functions.php file of your theme. Hope this helps:

add_filter('woocommerce_order_item_name', 'woo_order_item_with_link', 10, 3);
function woo_order_item_with_link( $item_name, $item, $bool ) {
    $url = get_permalink( $item['product_id'] ) ;
    return '<a href="'. $url .'">'. $item_name .'</a>'; 
}

Leave a Reply

Your email address will not be published. Required fields are marked *