Home › Forums › Themes Support › Claue › Fatal Error using php 8.2 on wordpress woocommerce with claue theme
- This topic has 1 reply, 1 voice, and was last updated 1 month, 3 weeks ago by
bestfitbybrazil.
-
AuthorPosts
-
-
October 5, 2023 at 2:57 am #44121
When i switch to 8.2 php, i get fatal error on the single product page when try to open. The page errors out with no content showing. the error log shows the following.
This is the errors;
Uncaught TypeError: strpos(): Argument #1 ($haystack) must be of type string, array given in /home/bso9rmrk88m2/public_html/wp-content/themes/claue-child/functions.php:1791This the full hook snippet:
// Hook For Remove Add product to cart message from single product page
function remove_added_to_cart_notice()
{
$notices = WC()->session->get(‘wc_notices’, array());foreach( $notices[‘success’] as $key => &$notice){
if( strpos( $notice, ‘has been added’ ) !== false){
$added_to_cart_key = $key;
break;
}
}
unset( $notices[‘success’][$added_to_cart_key] );WC()->session->set(‘wc_notices’, $notices);
}
add_action(‘woocommerce_before_single_product’,’remove_added_to_cart_notice’,1);
add_action(‘woocommerce_shortcode_before_product_cat_loop’,’remove_added_to_cart_notice’,1);
add_action(‘woocommerce_before_shop_loop’,’remove_added_to_cart_notice’,1);This is the line 1701 the error references from that snippit above
if( strpos( $notice, ‘has been added’ ) !== false){
$added_to_cart_key = $key;
break;The file is the Claue child Theme file functions.php.
how to fix this?
-
October 6, 2023 at 4:28 am #44123
Nevermind this was resolved
-
-
AuthorPosts
You must be logged in to reply to this topic.