I am working on a woo-commerce theme. On the product page when user doesn't select any attribute and tries to add product to the cart, it shows error on the alert box like this

enter image description here

I want to make red outline on the options that are not selected as an error?? how to do that?? I have changed the message as client asked for it with the code below.

add_filter( 'gettext', 'customizing_variable_product_message', 97, 3 );
function customizing_variable_product_message( $translated_text, $untranslated_text, $domain )
    if ($untranslated_text == 'Please select some product options before adding this product to your cart.') {
        $translated_text = __( 'Please select all "Options" before adding product to the cart.', $domain );
    return $translated_text;

Also want to replace domain name and the upper text with the websites logo. Please tell me how to do that.

  • Welcome to WPSE! We don't support third-party plugins or themes here. You might try on the theme's official support channels. JS alert boxes like this can't contain images - they don't accept any CSS styling at all - so you would have to remove the alert entirely and replace it with a modal if you still want a popup in addition to highlighting the fields themselves. – WebElaine Jan 28 at 21:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.