2014-03-13 52 views

回答

4

我目前使用此解決方案,這是我在另一個頁面上的評論中。這不是我的代碼。

http://www.vanbodevelops.com/tutorials/add-a-link-back-to-the-order-in-woocommerce-new-order-notifications-email#comment-636

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

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

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

return '<a href="'. $link .'" rel="nofollow">'. $item_name .'</a>'; 

} 
+0

對於那些有興趣,它進入functions.php文件,而不是電子郵件模板。我想讓它在Facebook上分享。 – Jason

0

我一直想知道這是如何工作爲好。幾乎沒有任何信息可用 - 至少在詳細的分步說明中沒有多少信息。

我想出的最佳解決方案是編輯customer-processing-order.php。

我所做的只是在文本編輯器打開它,並添加文本的幾行:

「您的訂單已收到,目前正在處理您的訂單詳情如下,供大家參考。請訪問「http://www.youlinkurl

最終用戶將不得不遺憾的是複製並粘貼鏈接,但至少它的工作原理

0

從gunbunnysoulja答案的偉大工程,但需要兩個小更新:。

  • get_product必須wc_get_product
  • $ _product-> ID必須$ _product-> get_id()

更新的答案如下:

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>'; 
} 
相關問題