Home › Forums › WoodMart support forum › template-tag error line 1176
template-tag error line 1176
- This topic has 1 reply, 2 voices, and was last updated 3 years, 2 months ago by Luke Nielsen.
-
AuthorPosts
-
September 21, 2021 at 5:55 am #319923
neumeithParticipantHi,
my customer gets this error from wordpress – what should we do:WordPress-Version 5.8.1
Aktuelles Theme: Woodmart Child (Version 1.0.0)
Aktuelles Plugin: (Version )
PHP-Version 7.4.23Fehler-Details
==============
Ein Fehler vom Typ E_ERROR wurde in der Zeile 1176 der Datei /home/customer/www/zuckerfrei.store/public_html/wp-content/themes/woodmart/inc/integrations/woocommerce/template-tags.php verursacht. Fehlermeldung: Uncaught Error: Call to a member function get_cart_contents_count() on null in /home/customer/www/zuckerfrei.store/public_html/wp-content/themes/woodmart/inc/integrations/woocommerce/template-tags.php:1176
Stack trace:
#0 /home/customer/www/zuckerfrei.store/public_html/wp-content/themes/woodmart/inc/modules/sticky-toolbar.php(265): woodmart_cart_count()
#1 /home/customer/www/zuckerfrei.store/public_html/wp-content/themes/woodmart/inc/modules/sticky-toolbar.php(150): woodmart_sticky_toolbar_cart_template()
#2 /home/customer/www/zuckerfrei.store/public_html/wp-includes/class-wp-hook.php(303): woodmart_sticky_toolbar_template(”)
#3 /home/customer/www/zuckerfrei.store/public_html/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters(NULL, Array)
#4 /home/customer/www/zuckerfrei.store/public_html/wp-includes/plugin.php(470): WP_Hook->do_action(Array)
#5 /home/customer/www/zuckerfrei.store/public_html/wp-includes/general-template.php(3031): do_action(‘wp_footer’)
#6 /home/customer/www/zuckerfrei.store/public_September 21, 2021 at 9:41 am #320006
Luke NielsenKeymasterHello,
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
-
AuthorPosts
Tagged: template tag
- You must be logged in to create new topics. Login / Register