Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to add woocommerce cart counter

<a href="<?php echo wc_get_cart_url() ?>" class="misha-cart">Cart (<?php echo $woocommerce->cart->cart_contents_count ?>)</a>
Comment

how to add woocommerce cart counter

add_filter( 'woocommerce_add_to_cart_fragments', 'misha_add_to_cart_fragment' );
 
function misha_add_to_cart_fragment( $fragments ) {
 
	global $woocommerce;
 
	$fragments['.misha-cart'] = '<a href="' . wc_get_cart_url() . '" class="misha-cart">Cart (' . $woocommerce->cart->cart_contents_count . ')</a>';
 	return $fragments;
 
 }
Comment

PREVIOUS NEXT
Code Example
Php :: how to override default name for apiresourc route in laravel 
Php :: get user avatar wordpress 
Php :: php remove specific element from array 
Php :: add column in table laravel 
Php :: disable block editor on widget section wordpress 
Php :: explode function in laravel 
Php :: php check array is not associative 
Php :: how to write for loop in laravel blade 
Php :: how to one increment after post in laravel collective 
Php :: acf get user form field 
Php :: orderby text values eliquent laravel 
Php :: Laravel Session using Global Session php function 
Php :: php mail success message 
Php :: Creating a Basic Route in Laravel 8 
Php :: php current date 
Php :: unset session in php 
Php :: Install the php_mysql extensions 
Php :: array_search in php 
Php :: php keep only letters and numbers 
Php :: laravel eloquent get last record 
Php :: get raw query laravel 
Php :: get theme path wordpress dev 
Php :: global laravel request() 
Php :: padding number in php 
Php :: php artisan make:auth Command "make:auth" is not defined. 
Php :: how match array in laravel collection 
Php :: php $randomUA[rand(0, count($randomUA) 1) 
Php :: disable cors policy symfony 
Php :: how to uninstall php from mac catalina completely 
Php :: remove all items of an array except the last one in php 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =