src/widgets/ShopGlobalWidget.php
public function run()
    {
        if (static::$isRegisteredAssets === false) {
            ShopAsset::register($this->getView());
            $options = (array)$this->clientOptions;
            $options['cartData'] = \Yii::$app->shop->cart->shopOrder->jsonSerialize();

            $options = Json::encode($options);

            $this->getView()->registerJs(<<<JS
    (function(sx, $, _)
    {
        sx.Shop = new sx.classes.shop.App($options);
    })(sx, sx.$, sx._);
JS
            );
            static::$isRegisteredAssets = true;
        }

        return parent::run();
    }
public function run()
    {
        if (static::$isRegisteredAssets === false) {
            ShopAsset::register($this->getView());
            $options = (array)$this->clientOptions;
            $options['cartData'] = \Yii::$app->shop->cart->shopOrder->jsonSerialize();

            $options = Json::encode($options);

            $this->getView()->registerJs(<<<JS
    (function(sx, $, _)
    {
        sx.Shop = new sx.classes.shop.App($options);
    })(sx, sx.$, sx._);
JS
            );
            static::$isRegisteredAssets = true;
        }

        return parent::run();
    }
Подготовка данных для шаблона
@return $this