$trigger, 'autoOpen' => $auto_open ? 'yes' : 'no', 'autoOpenDelay' => $delay, 'cartUrl' => wc_get_cart_url(), ] ); } /** * Output the floating cart button HTML in the footer. */ public function render_floating_cart(): void { $count = WC()->cart ? WC()->cart->get_cart_contents_count() : 0; ?> cart ? WC()->cart->get_cart_contents_count() : 0; $fragments['#cgkit-fc-count'] = $this->count_badge_html( $count ); return $fragments; } // ------------------------------------------------------------------------- // Private helpers // ------------------------------------------------------------------------- /** * Return the count badge HTML (targeted by fragments). */ private function count_badge_html( int $count ): string { $hidden = 0 === $count ? ' cgkit-floating-cart__count--hidden' : ''; return sprintf( '', esc_attr( $hidden ), esc_html( $count > 0 ? $count : '' ) ); } /** * Shopping-cart SVG icon (Feather icons style, matches CommerceKit aesthetic). */ private function cart_icon_svg(): string { return ''; } } /** * Bootstrap after WooCommerce is loaded so WC() is available. */ add_action( 'woocommerce_loaded', function () { CommerceKit_Floating_Cart::get_instance(); } );