如何在woocommerce电子邮件中使产品名称成为链接

时间:2019-12-27 22:08:29

标签: php wordpress woocommerce

我有一个woocommerce电子商店,我正在尝试修改woocommerce电子邮件。

更具体地说,我希望产品名称是产品的链接,以便客户能够返回并对该产品进行评论。

我当时想在电子邮件标题中添加类似内容。“请点击产品进行查看”

如何使产品标题成为链接?

谢谢

2 个答案:

答案 0 :(得分:0)

https://businessbloomer.com/woocommerce-visual-hook-guide-emails/

https://www.tychesoftwares.com/how-to-customize-woocommerce-order-emails/

function my_email_header( $email_heading, $email ) { 
    echo "<p>Please click on product to review it</p>";
}
add_action( 'woocommerce_email_header', 'my_email_header', 10, 2 );

function my_order_item_name( $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>';
}
add_filter( 'woocommerce_order_item_name', 'my_order_item_name', 10, 2 );

答案 1 :(得分:0)

<?php
add_action( 'woocommerce_email_header', 'ts_email_header', 10, 2 );
function ts_email_header( $email_heading, $email ) { 
    echo '<a href="'.wp_review_url( Review_url() ).'"></a>Please click on product to review it';
}