Start a conversation

Alert box popup if the customer chooses wrong color/size variation

I want to have an alert box popup if the customer chooses
Color Black AND if the Size is NOT Men's.
Black only available for men.

Color:
Black (Men Only)
Black/Blue

Size
Men's S
Men's M
Men's L
Men's ML
Men's LT
Men's L
Men's L
Men's XL
Men's 2XL
Men's 3XL
Women's XS
Women's S
Women's M
Women's L
Women's XL
Women's 2XL

ANSWER
------------------------------------------------------
In "Modify product" interface -> "Option validation" section
you can program the javascript:

if (product_option('Color').selectedIndex == 0 && product_option('Size').selectedIndex > 9) {
alert('Sorry, the black only for men');
return false;
}

return true;

There is "selectedIndex > 9" because option number 9 and up are women's sizes (option numbers start from 0 not 1).
Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Admin FinestShops

  2. Posted

Comments