WooCommerce - unset “ removed notice…” on cart page

后端 未结 4 1238
没有蜡笔的小新
没有蜡笔的小新 2020-12-20 05:24

actions and filters. On my WooCommerce site I get the following message when I remove a product from the shopping cart:

\"\" removed. Und         


        
4条回答
  •  遥遥无期
    2020-12-20 06:04

    I had to change this to get it to work. Specifically, the array field is singular notice or at least it is now.

    $notices = WC()->session->get('wc_notices', array());
    foreach( $notices['notice'] as $key => &$notice){
        if( strpos( $notice, 'whilst' ) !== false){ 
            $BadNotice_key = $key;
            unset( $notices['notice'][$BadNotice_key] );
            WC()->session->set('wc_notices', $notices);
            break;
        }
    }
    

提交回复
热议问题