You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue only happens when you have the following plugins active:
Genesis Connect for WooCommerce
WooCommerce
Perfect WooCommerce Brands (PWB)
And
You have breadcrumbs enabled on archives
You've used PWB "Filter by Brand" widget on a product category archive page, And
You have parent/child "brands" (PWB have made their taxonomy hierarchical) and products within them
On the front end you select a child brand term (it works fine if you select a parent term)
You get:
Recoverable fatal error: Object of class WP_Error could not be converted to string in /wp-includes/formatting.php on line 1117 There has been a critical error on your website.
I have traced this error back to genesis-connect-woocommerce/lib/breadcrumb.php line 204 in the function:
Looking at this some more... the issue is that get_query_var( 'taxonomy' ); and get_query_var( 'term' ); are returning the pwb-brands taxonomy and term, even though we are on the product_cat archive.
My "fix" produces a hybrid ( home > parent brand > product category ) non-sensical breadcrumb.
I've noticed that on this product_cat archive, when the filter is active:
get_query_var( 'taxonomy' ) & get_query_var( 'term' ) returns pwb_brands and the pwb_brands term,
get_queried_object returns product_cat taxonomy and term.
This issue only happens when you have the following plugins active:
And
You get:
Recoverable fatal error: Object of class WP_Error could not be converted to string in /wp-includes/formatting.php on line 1117 There has been a critical error on your website.
I have traced this error back to genesis-connect-woocommerce/lib/breadcrumb.php line 204 in the function:
It is because the $url is an error passed by line number 104 in the same file:
There needs to be a check on $item to ensure it is not an error before the slug is passed to gencwooc_get_crumb_link().
Why is it an error in this case?
There is an assumption that the taxonomy is a product_cat (which is fair enough as we're in a "is_tax( 'product_cat' )" conditional).
But when the filter is triggered, even though we are on a product_cat archive, the term return on line 87 by:
get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
is actually a pwb-brand taxonomy and not a product_cat
I appreciate this is a very edge case, but if you change line 104 to the below then it fixes the error (hopefully without any bad consequence?)
The text was updated successfully, but these errors were encountered: