How to disable color variant that is not applicable to a size but available to other sizes

Hi All,

I have a product that comes in 3 sizes and each has color variants. I would like to know if it is possible that if a color does not apply to the 2nd size but is available in the 1st and 3rd sizes, how can I hide the certain color that doesn’t apply to the specific size of that product? (I don’t know if I make myself any sense but here’s an example)

For example:

The product is a T-shirt.

Size - Color Variants:

Small - red ; Small - white ; Small - black

XL - red ; XL - black

XXL red ; XXL - white ; XXL - black

The color white is only available for sizes Small and XXL. In the color variant selection, how I will disable to select the color white if in the size variant selection they choose the XL? and if they choose the sizes of small and XXL, the white variant will show up again?

Appreciate your answer :slightly_smiling_face: Super thank you!

Hi @Ann07 ,

If you’re looking to hide unavailable variants, you can achieve this by adding custom code to the Custom Liquid section in your theme :blush: :