📅  最后修改于: 2022-03-11 14:53:53.236000             🧑  作者: Mango
add_filter( 'woocommerce_add_to_cart_fragments', 'misha_add_to_cart_fragment' );
function misha_add_to_cart_fragment( $fragments ) {
global $woocommerce;
$fragments['.misha-cart'] = 'Cart (' . $woocommerce->cart->cart_contents_count . ')';
return $fragments;
}