<?php
    
    namespace frontend\widgets;
    
    use artbox\catalog\models\Product;
    
    class OptionPicker
    {
        public static function getHelper(Product $product)
        {
            $helper = new VariantGroupHelper();
            /**
             * @var \artbox\catalog\models\Variant[] $variants
             */
            $variants = $product->getVariants()
                                ->all();
            foreach ($variants as $variant) {
                $helper->addVariant($variant);
            }
            return $helper;
        }
    }