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', 'checkout_summary' => 'renderCheckoutSummary' ]; if(isset($maps[$fragmentName])) { ob_start(); $this->{$maps[$fragmentName]}(); return ob_get_clean(); } return ''; } public function render() { ?>
maybePopulateFormDataFromCustomer(); // Trigger the recalc only when the cart hasn't been taxed yet. Once // line_meta.tax_config is on the item, the badge already renders from // existing data — another recalc here would just duplicate work // (Tax + Shipping each call $cart->save() on this action). // Payload shape matches Cart::addItem() so every handler receives the // data it expects. if (empty(Arr::get($this->cart->cart_data, '0.line_meta.tax_config'))) { do_action('fluent_cart/cart/cart_data_items_updated', [ 'cart' => $this->cart, 'scope' => 'modal_open', 'scope_data' => null, ]); } ?>