簡體   English   中英

在 WooCommerce 單個產品頁面中的添加到購物車按鈕下方添加自定義文本

[英]Add custom text below Add To Cart button in WooCommerce single product pages

所以我附上了我的問題的圖片。

代碼就在按鈕上

基本上我按照這里的堆棧溢出問題線程的說明進行操作:
添加到購物車 (woocommerce) 下的文本

我在那里發布了 5 次我的問題,有人一直在刪除它,所以我再次發布在這里。 請指教。

更新:我已經嘗試了段落標記、中斷標記和預標記。

你可以試試這個(你會看到這是一個帶有margin-top的CSS樣式問題):

add_action( 'woocommerce_after_add_to_cart_button', 'custom_content_after_addtocart_button', 100 );
function custom_content_after_addtocart_button() {
    // custom content.
    echo '<br/><div><p style="font-size:10px; font-style=italic; margin-top:20px;">(*Contact us for bulk purchase enquiry)</p></div>';
}

代碼位於活動子主題(活動主題或任何插件文件)的 function.php 文件中。

測試和工作。 你會得到:

在此處輸入圖片說明

此代碼將它很好地放置在“添加到購物車”按鈕下方:

add_action( 'woocommerce_after_add_to_cart_form','content_after_addtocart', 100 );
  function content_after_addtocart() {
  // place your content below.
  echo 'Hello There !!';

   }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM