Alternative for the wc_add_to_cart_message hook in Woocommerce for WP

后端 未结 5 516
轮回少年
轮回少年 2020-12-17 00:48

I used the add to cart message hook in Woocommerce to edit the text and remove some classes from certain buttons. It seems this hook is now deprecated in Woocommerce 2.1 and

5条回答
  •  青春惊慌失措
    2020-12-17 01:08

    As of 2020 this is the filter required: wc_add_to_cart_message has been deprecated. Here I am simply wrapping the message in span:

    //New added to card message text
    function filter_wc_add_to_cart_message_html( $message, $products ) { 
      return "".$message.""; 
    }; 
    add_filter( 'wc_add_to_cart_message_html', 'filter_wc_add_to_cart_message_html', 10, 2 ); 
    

提交回复
热议问题