cart = $cart; $this->config = $config; $this->requireShipping = $cart->requireShipping(); $this->storeSettings = new StoreSettings(); $this->checkoutRenderer = new CheckoutRenderer($cart); $this->cartSummaryRenderer = new CartSummaryRender($cart); $this->hasSubscription = $cart->hasSubscription(); $this->customer = CustomerResource::getCurrentCustomer(); $this->productMeta = ProductMeta::query()->where('object_id', Arr::get($this->cart->cart_data, '0.post_id'))->where('meta_key', 'license_settings')->first(); $variations = $this->productMeta->meta_value['variations'] ?? []; $cartItem = $this->cart->cart_data[0] ?? []; $objectId = $cartItem['object_id'] ?? null; $this->matchedVariation = $objectId && isset($variations[$objectId]) ? $variations[$objectId] : null; } public function getFragment($fragmentName) { $maps = [ 'payment_methods' => 'renderPaymentMethods', 'summary_group' => 'renderSummaryGroup' ]; if(isset($maps[$fragmentName])) { ob_start(); $this->{$maps[$fragmentName]}(); return ob_get_clean(); } return ''; } public function render() { ?>