fbpx
Want To Add Extra Images Per Product Variation For Free? Download Now

Message Please select some product options before adding this product to your cart.

Hello,

When NOT selecting options for my variable products, the add to cart button is greyed out. I would like to see a pop-up message when clicking the add to cart button like: “Please select some product options before adding this product to your cart.”

Like this shop has: https://tap2review.nl/product/booking-review-kaart/

How can I add a message like this?

Is there a checkbox I missed checking in your plugin? Or is there a code I can add?

I hope someone can help me add this.

Greetings!

Hakik Zaman

Hi Marcel,

Thanks for reaching out to us. Unfortunately, displaying the message “Please select some product options before adding this product to your cart.” is a default behavior of WooCommerce. If you disable our Swatches plugin, you will get the same message.

You can add the following snippet using the Code Snippets plugin or add the following code inside your current theme’s funcitons.php file:

add_filter('woocommerce_get_script_data', function( $params, $handle ){
$params['i18n_make_a_selection_text'] = esc_attr__( 'MY MESSAGE HERE.', 'woocommerce' );
return $params;
}, 10, 2);

Note: Please replace the MY MESSAGE HERE. to set your own message.

Another Note: If you are using a child theme then add the above code inside your child theme’s functions.php. I will suggest you use the Code Snippets plugin to add additional code. Here is the setup of the custom code using the Code Snippets plugin: https://paste.pics/PN4OT

By the way, we really get excited & honored when you use our plugin on your site.

If you found my support helpful, could you please leave your valuable review here: https://wordpress.org/support/plugin/woo-variation-swatches/reviews/?filter=5

Your rating keeps us inspired.

Thank You


Turns out it was a Theme thing and was resolved by adding this custom CSS to Appearance > Customize > Additional CSS.

.single_add_to_cart_button.button { pointer-events: initial; }