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:1791
This 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?