WooCommerce:删除/编辑“添加到购物车”消息

< 1 min read

仿牌独立站出海专家

PHP Snippet#1:删除“ X已添加到您的购物车”消息


add_filter( 'wc_add_to_cart_message_html', '__return_null' );

PHP Snippet#2:编辑“已添加到您的购物车”消息


add_filter( 'wc_add_to_cart_message_html', 'bbloomer_custom_add_to_cart_message' );
 
function bbloomer_custom_add_to_cart_message() {
$message = 'Nicely done!' ;
return $message;
}