A lot of the time, users will miss the attribute drop down on a variable product page and immediately go for the add to cart button. If this happens, and the user has not yet selected an option from the drop down, a window alert will appear saying “Choose Some Product Options”. This is not particularly user friendly and definitely isn’t tailored towards your product range. Being more specific with messages can benefit the user experience and help them understand what they are doing wrong and what they need to do in order to proceed. Making the ability to add a product to cart should not be difficult! This short guide shows you can change change this alert message to something a little more specific to your product range.
/**
* Snippet Name: Change the "Choose some product options" text on WooCommerce variable product drop-downs.
* Snippet Author: ecommercehints.com
*/
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['i18n_make_a_selection_text'] = __( 'Please select a date first', 'domain' );
return $params;
}