Woocommerce 产品单页数量选择前面加文字

时候现在Woocommerce产品数量前面加上单位 或者简单的说明,方法有两个

Woocommerce 产品单页数量选择前面加文字

一、Css添加

在后台–>外观–>主题编辑器–>style.css(大多数主题是在这里,国外多功能主题就在主题设置里面找到自定义css)添加上以下代码

.quantity:before {
content:”瓶数:”;
margin-right:10px
}
.quantity input {
display:inline;
margin-right:30px
}
.woocommerce-variation-add-to-cart {
margin-top:20px
}

二、functions.php代码添加

在后台–>外观–>主题编辑器–>functions.php 最下方添加以下代码,如果需要微调样式 在css里面添加.yongwp_qty 样式效果

add_action( 'woocommerce_before_add_to_cart_quantity', 'yongwp_echo_qty_front_add_cart' );
 
function yongwp_echo_qty_front_add_cart() {
 echo '<div class="yongwp_qty">个数: </div>'; 
}

 

Share:

给我们留言

Luxury Real Estate

Lorem ipsum dolor sit amet, cons aring elit sed dllao the eimod tempor inciunt ullaco laboris aliquip alora tolfy alora tolda foucos dondy athlle shalom.

Contact Information

Copyright © 亚格美(深圳)科技有限公司 | 皖公网安备 34010302002247号 | 皖ICP备2021015631号