How to change woocommerce notices text, i tried everything searching on google and i even tried chatgpt to generate an unpurchasable notice and it came up with this
function custom_modify_unpurchasable_product_message( $message, $product ) {
// Get the product name
$product_name = $product->get_name();
// Check if the product is free
if ( $product->get_price() == 0 ) {
$reason = __('because it is free', 'woocommerce');
} else {
$reason = __('because it has been disabled', 'woocommerce');
}
// Modify the message
$message = sprintf( __('%s cannot be purchased %s.', 'woocommerce'), $product_name, $reason );
return $message;
}
add_filter( 'woocommerce_cart_product_cannot_add_another_message', 'custom_modify_unpurchasable_product_message', 10, 2 );
That dont work and also for some reason add it to woocommerce_cart_product_cannot_add_another_message