Hello everyone. I’m currently working on my product page, where all variation options are displayed on a single page. I would like to change the background color of the page based on the selected Flavor. For example, when one flavor is selected, the bg color changes smoothly to the flavor’s main color.
Here’s the link: https://www.yak9chews.com/collections/yak9-chews/products/test-all-chews-and-flavors?variant=42024933359813
My basic idea is to use a conditional structure like this:
if (variation == variationNumber)
{
bgColor = “someColorHex”;
}
else if (variation == variationNumber1)
{
bgColor = “someColorHex2”;
}
…
else {
bgColor = default;
}
However, I’m not certain about this approach. I’ve been struggling with this issue for a month now and would appreciate any assistance. Thank you.