settings are made in such a way that you can easily change the alert text on add to cart action without selected variation in

Also is by default made to sell products so when using variation, it becomes really touch to change the error message to something else if you are not selling products.

Lets say you are selling a course or similar, adding a message saying please select all course options or something like that is nearly impossible directly.

Luckily, there is a bit technical way but manageable way to do it.

Firstly, we highly recommend you use your child theme to make this edit. Why child theme ? well when your mail theme is updated, its functions.php is also updated so if you make changes in your live theme, this will be lost upon update, but you child theme will not be updated and you can post any custom codes there.

Now the main part, how to Change the alert text on add to cart action without selected variation in Woocommerce

Drop the below code snippet (with relevant variables) into your child themes functions.php file.

add_filter( ‘woocommerce_get_script_data’, ‘change_alert_text’, 10, 2 );
function change_alert_text( $params, $handle ) {
if ( $handle === ‘wc-add-to-cart-variation’ )
$params[‘###INSERT YOUR VARIABLE HERE###’] = __( ‘Your new alert text’, ‘domain’ );
return $params;

Replace ###INSERT YOUR VARIABLE HERE### with any of the following (VARIABLE =>Default Message/Error/Text):

‘i18n_no_matching_variations_text’ => ‘Sorry, no products matched your selection. Please choose a different combination.’
‘i18n_make_a_selection_text’ => ‘Please select some product options before adding this product to your cart.’
‘i18n_unavailable_text’ => ‘Sorry, this product is unavailable. Please choose a different combination.’

You can replicate the code to replace multiple shop wide errors by using:

Custom Error 1: $params[‘i18n_make_a_selection_text’] = __( ‘Hey, you… yeah you… make a selection!’, ‘domain’ );

Custom Error 2: $params[‘i18n_unavailable_text’] = __( ‘Oh no we’ve run out of that product but it’s not the end of the world it’ll be back soon’, ‘domain’ );

Hope this helps in solving the issue.

Buy Avada