cartItems = $cartItems; $this->itemCount = Arr::get($config, 'item_count') ?? count($this->cartItems); $this->countMode = Arr::get($config, 'count_mode', 'distinct_products'); } public function renderMiniCart($atts = []) { $defaults = [ 'is_shortcode' => false, ]; $atts = wp_parse_args($atts, $defaults); $cartIcon = Arr::get($atts, 'cart_icon', 'cart'); $showItemCount = Arr::get($atts, 'show_item_count', 'has_items'); $showTotalPrice = filter_var(Arr::get($atts, 'show_total_price', true), FILTER_VALIDATE_BOOLEAN); $iconColor = Arr::get($atts, 'icon_color', ''); $priceColor = Arr::get($atts, 'price_color', ''); $productCountColor = Arr::get($atts, 'product_count_color', ''); $buttonClass = (string) Arr::get($atts, 'button_class', ''); // Build style attribute $iconStyle = $iconColor ? 'style="color: ' . esc_attr($iconColor) . ';"' : ''; $priceStyle = $priceColor ? 'style="color: ' . esc_attr($priceColor) . ';"' : ''; $countStyle = $productCountColor ? 'style="background-color: ' . esc_attr($productCountColor) . ';"' : ''; $isShortcode = Arr::get($atts, 'is_shortcode', false); $wrapperAttributes = ''; if(!$isShortcode){ $wrapperAttributes = RenderHelper::getBlockWrapperAttributes(); } $subtotal = empty($this->cartItems) ? Helper::toDecimal(0, true) : CartCheckoutHelper::make()->getItemsAmountSubtotal(true, true); $aria_label = sprintf( /* translators: 1: Total price */ __('Total cart price: %1$s', 'fluent-cart'), esc_attr($subtotal) ); $showBadge = false; if ($showItemCount === 'always') { $showBadge = true; } elseif ($showItemCount === 'has_items' && $this->itemCount > 0) { $showBadge = true; } ?>