Created
November 21, 2021 17:44
-
-
Save siaeb/dd17c5c9bf7edf2a7d8a76d45d9d1565 to your computer and use it in GitHub Desktop.
WooCommerce : Append number of cart items into ajax response when add or delete product
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_add_to_cart_fragments', 'siaeb_change_cart_fragments' ); | |
function siaeb_change_cart_fragments($args) { | |
$args['items'] = [ | |
'count' => WC()->cart->get_cart_contents_count(), | |
]; | |
return $args; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment