【问题标题】:Add custom text below Add To Cart button in WooCommerce single product pages在 WooCommerce 单个产品页面中的“添加到购物车”按钮下方添加自定义文本
【发布时间】:2018-03-22 13:52:57
【问题描述】:

所以我附上了我的问题的图片。

基本上,我在这里按照 Stack Overflow 问题线程上的说明进行操作:
Text under Add to cart (woocommerce)

我在那里发布了我的问题 5 次,但有人一直删除它,所以我在这里再次发布。请指教。

更新:我已经尝试过段落标签、中断标签和前置标签。

【问题讨论】:

标签: php css wordpress woocommerce product


【解决方案1】:

你可以试试这个(你会看到这是 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 文件中。

经过测试并且有效。你会得到:

【讨论】:

    【解决方案2】:

    此代码将其放置在“添加到购物车”按钮下方:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-03-05
      • 2020-09-01
      • 2015-12-04
      • 2019-07-16
      • 2015-05-24
      • 2021-06-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多