Home Forums WoodMart support forum Moved: Reply To: Cosmetic issues after updating from 6.0.4 to 6.1.4

Moved: Reply To: Cosmetic issues after updating from 6.0.4 to 6.1.4

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #321494

    wildguitars
    Participant

    I’ve just noticed that after I added the WOODMART Price Filter, I received an email from the website with the following errors:

    אירעה שגיאה מסוג E_ERROR בשורה 1176 בקובץ /home/dev2/public_html/wp-content/themes/woodmart/inc/integrations/woocommerce/template-tags.php. הודעת שגיאה: Uncaught Error: Call to a member function get_cart_contents_count() on null in /home/dev2/public_html/wp-content/themes/woodmart/inc/integrations/woocommerce/template-tags.php:1176
    Stack trace:
    #0 /home/dev2/public_html/wp-content/themes/woodmart/inc/modules/sticky-toolbar.php(265): woodmart_cart_count()
    #1 /home/dev2/public_html/wp-content/themes/woodmart/inc/modules/sticky-toolbar.php(150): woodmart_sticky_toolbar_cart_template()
    #2 /home/dev2/public_html/wp-includes/class-wp-hook.php(303): woodmart_sticky_toolbar_template()
    #3 /home/dev2/public_html/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters()
    #4 /home/dev2/public_html/wp-includes/plugin.php(470): WP_Hook->do_action()
    #5 /home/dev2/public_html/wp-includes/general-template.php(3031): do_action()
    #6 /home/dev2/public_html/wp-includes/blocks/legacy-widget.php(123): wp_footer()
    #7 /home/dev2/public_html/wp-includes/class-wp-hook.php(303): handle_legacy_widget_preview_iframe()
    #8 /home/dev2/public_html/wp-includes/class-wp-hook.php(327): WP_Hook

    #321583

    Hello,

    Please, try to add this code to the functions.php file in your child theme

    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
    }

    Kind Regards

Viewing 2 posts - 1 through 2 (of 2 total)