text Woocomerce退回产品柜台
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text Woocomerce退回产品柜台相关的知识,希望对你有一定的参考价值。
IN FUNCTIONS PHP
================
/**
* Woocomerce listening counter.
*/
function woocommerce_header_add_to_cart_fragment( $fragments = array()) {
ob_start();
$cart_count = WC()->cart->get_cart_contents_count();
?>
<span id="cart-count" class="cart-counter">
<?php echo $cart_count;?>
</span>
<?php
$fragments['#cart-count'] = ob_get_clean();
return $fragments;
} // end function woocommerce_add_to_cart_fragments
add_filter('woocommerce_add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment');
IN TEMPLATE
===========
<?php echo woocommerce_header_add_to_cart_fragment()['#cart-count'];?>
/**
* Mobile listening counter.
*/
function woocommerce_header_add_to_cart_fragment2( $fragments = array()) {
ob_start();
$cart_count = WC()->cart->get_cart_contents_count();
?>
<span id="cart-count2" class="cart-counter">
<?php echo $cart_count;?>
</span>
<?php
$fragments['#cart-count2'] = ob_get_clean();
return $fragments;
} // end function woocommerce_add_to_cart_fragments
add_filter('woocommerce_add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment2');
IN TEMPLATE
===========
<?php echo woocommerce_header_add_to_cart_fragment2()['#cart-count2'];?>
以上是关于text Woocomerce退回产品柜台的主要内容,如果未能解决你的问题,请参考以下文章
text Woocomerce添加当前产品attr(仅)值
text Woocomerce - 添加当前产品的名称和值
text Woocomerce类别页面添加分页
text Woocomerce删除优惠券
text Woocomerce在向购物车添加其他特定商品时删除特定购物车商品
text 迷你购物车更新数量计数迷你购物车购物车ajax购物车柜台ajax