2017-06-02 83 views

回答

1

轉到woocommerce模板single-product\add-to-cart的以下目錄。然後在這個目錄下的每個php文件中搜索add_to_cart_button。您將找到相關的html標籤來添加自定義工具提示。談話後


更新答案:

/** 
* Custom Add To Cart Messages 
* Add this to your theme functions.php file 
**/ 

add_filter('wc_add_to_cart_message_html', 'woocommrece_custom_add_to_cart_message'); 

function woocommrece_custom_add_to_cart_message() { 
global $woocommerce; 

$twoDayFromNow = date('l' , strtotime('tomorrow + 1day')); 
$messageContent = 'Your product will be delivered by ' . $twoDayFromNow . ' if you checkout today'; 

// Output success messages 
if (get_option('woocommerce_cart_redirect_after_add')=='yes') : 
    $return_to = get_permalink(wc_get_page_id('shop'));// Give the url, you want to redirect 
    $message = sprintf('<a href="%s">%s</a> %s', $return_to, __('Continue Shopping &rarr;', 'woocommerce'), __($messageContent, 'woocommerce')); 
else : 
    $message = sprintf('<a href="%s">%s</a> %s', get_permalink(wc_get_page_id('cart')), __('View Cart &rarr;', 'woocommerce'), __($messageContent, 'woocommerce')); 
endif; 

return $message; 
} 
/* Custom Add To Cart Messages */ 
+0

是在添加到購物車目錄中,你會發現'variable.php'&'grouped.php'文件。請檢查目錄。 – gvgvgvijayan

+0

找到此行。我在這裏編輯什麼?抱歉!不是編碼器。只是想完成一些事情。感謝您對我的耐心:) –

+0

您使用的代碼片段來自用戶查看簡單產品頁面時顯示的文件'simple.php'。 ''。你見過在html標籤'button'中添加屬性'title'嗎?現在,如果用戶將鼠標懸停在「添加到購物車」按鈕上,標題將顯示爲工具提示。 – gvgvgvijayan

相關問題