Site logo

Archived topic

Customize the Mini Cart using WooCommerce Hooks

2 replies · Started by Arthur on April 30, 2019

Viewing posts 1–3 of 3

I'm trying to modify some sections of the Mini Cart output using the WC woocommerce_widget_cart_item_quantity hook (I want to display the price without the quantity). Using this hook in my themes functions.php file does NOT seem to be working. Here is my Hook code:

add_filter('woocommerce_widget_cart_item_quantity', 'custom_wc_widget_cart_item_quantity', 50, 3 );
function custom_wc_widget_cart_item_quantity( $output, $cart_item, $cart_item_key ) {
	$output = '<span class="quantity hello">' . sprintf( '%s &times; %s', $cart_item['quantity'], $product_price ) . '</span>';
	return $output;
}

The above code only adds a 'hello' class just to check if the code is working.

Any ideas why this hook is not working? (this is a members only site)

Resolved. Must have been a caching issue.

Glad you got it working :)

This archived topic is closed to new replies.