Compare feature returns with an error.
-
I turned off the compare feature, but we received the error below in the error logs.
[2022-08-28T20:07:42.910266+00:00] PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, string given in /domain/wp-content/themes/woodmart/inc/integrations/woocommerce/modules/compare.php:418
[2022-08-28T20:07:42.910291+00:00] Stack trace:
[2022-08-28T20:07:42.910295+00:00] #0 /domain/wp-content/themes/woodmart/inc/integrations/woocommerce/modules/compare.php(351): woodmart_get_compare_fields()
[2022-08-28T20:07:42.910300+00:00] #1 /domain/wp-content/themes/woodmart/inc/integrations/woocommerce/modules/compare.php(23): woodmart_get_compared_products_table()
[2022-08-28T20:07:42.910303+00:00] #2 /domain/wp-includes/shortcodes.php(356): woodmart_compare_shortcode(”, ”, ‘woodmart_compar…’)
[2022-08-28T20:07:42.910306+00:00] #3 [internal function]: do_shortcode_tag(Array)
thanks
Hello,
Thank you for reaching out to us!
Please navigate to inc/integrations/woocommerce/modules/compare.php
file and on the 418th string replace this old if ( class_exists( 'XTS\Options' ) && count( $fields_settings ) > 1 ) {
condition to that if ( class_exists( 'XTS\Options' ) && $fields_settings && count( $fields_settings ) > 1 ) {
.
https://prnt.sc/04TMwX3GCZv1
Kind Regards