admin管理员组文章数量:1122832
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="">
<img src=".png" alt="Product Rating">
</a>
</div>
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="http://animax.cf/wp-content/uploads/2015/12/product-reviews.png" alt="Product Rating">
</a>
</div>
Share
Improve this question
edited Jan 1, 2016 at 19:23
Pieter Goosen
55.4k23 gold badges115 silver badges209 bronze badges
asked Jan 1, 2016 at 12:27
AnsAns
4292 gold badges5 silver badges10 bronze badges
2 Answers
Reset to default 12WooCommerce 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>';
}
You can also try this:
<a href="<?php get_permalink(get_the_id()); ?>">
<img src="http://animax.cf/wp-content/uploads/2015/12/product-reviews.png" alt="Product Rating">/>
</a>
本文标签: woocommerce offtopicGet product link
版权声明:本文标题:woocommerce offtopic - Get product link 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736295108a1929499.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论