Home Forums WoodMart support forum The WordPress 5.8 caught an error with Woodmart. please update the theme Reply To: The WordPress 5.8 caught an error with Woodmart. please update the theme

#316684

Hello,

Please add this code to the functins.php of the child theme we will fix this in out nearest update:

function woodmart_cart_count() {
		if ( ! is_object( WC() ) || ! property_exists( WC(), 'cart' ) || ! method_exists( WC()->cart, 'get_cart_contents_count' ) ) {
			return;
		}

		$count = WC()->cart->get_cart_contents_count();
		?>
			<span class="wd-cart-number<?php echo woodmart_get_old_classes( ' woodmart-cart-number' ); ?>"><?php echo esc_html( $count ); ?> <span><?php echo esc_html( _n( 'item', 'items', $count, 'woodmart' ) ); ?></span></span>
		<?php
	}

Best Regards