📜  AJAX 后更新购物车计数 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:37.701000             🧑  作者: Mango

代码示例1
//header or woocommerce.php
cart->get_cart_contents_count(); ?>
//function file add_filter( 'woocommerce_add_to_cart_fragments', 'iconic_cart_count_fragments', 10, 1 ); function iconic_cart_count_fragments( $fragments ) { $fragments['div.header-cart-count'] = '
' . WC()->cart->get_cart_contents_count() . '
'; return $fragments; }