From 2b565758f574411f67f50cb2cf2f4397d23c159e Mon Sep 17 00:00:00 2001 From: Malin Date: Thu, 5 Mar 2026 08:14:08 +0100 Subject: [PATCH] fix: correct minicart trigger selector to .shoptimizer-cart .cart-contents --- assets/js/floating-cart.js | 12 +++++------- cgkit-floating-cart.php | 6 +++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/assets/js/floating-cart.js b/assets/js/floating-cart.js index 18a736e..45fd43d 100644 --- a/assets/js/floating-cart.js +++ b/assets/js/floating-cart.js @@ -95,13 +95,11 @@ } // --- 2. Shoptimizer direct panel toggle -------------------------- - // Shoptimizer opens its cart panel by adding the 'active' class to - // .site-header-cart and showing the child .widget_shopping_cart. - // Try that directly if we couldn't find the button. - var $panel = $( '.site-header-cart' ); - if ( $panel.length ) { - $panel.toggleClass( 'active' ); - $panel.find( '.widget_shopping_cart' ).toggleClass( 'cart-open' ); + // Shoptimizer's cart anchor is a.cart-contents inside .shoptimizer-cart. + // If the selector loop above somehow missed it, grab it directly. + var $directBtn = $( '.shoptimizer-cart a.cart-contents' ); + if ( $directBtn.length ) { + $directBtn[ 0 ].click(); return; } diff --git a/cgkit-floating-cart.php b/cgkit-floating-cart.php index df11045..a797c55 100644 --- a/cgkit-floating-cart.php +++ b/cgkit-floating-cart.php @@ -3,7 +3,7 @@ * Plugin Name: CommerceKit Floating Cart * Plugin URI: https://www.commercegurus.com * Description: Adds a floating cart icon (bottom-right) and auto-opens the CommerceKit minicart after add to cart. Requires CommerceGurus CommerceKit and WooCommerce. - * Version: 1.0.1 + * Version: 1.0.2 * Author: CommerceGurus * Author URI: https://www.commercegurus.com * License: GPLv3 @@ -19,7 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; } -define( 'CGKIT_FC_VERSION', '1.0.1' ); +define( 'CGKIT_FC_VERSION', '1.0.2' ); define( 'CGKIT_FC_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); define( 'CGKIT_FC_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); @@ -110,7 +110,7 @@ class CommerceKit_Floating_Cart { */ $trigger = apply_filters( 'cgkit_fc_minicart_trigger', - '.site-header-cart .cart-click, .wcmenucart, a.cart-contents, .header-cart-link, .shoptimizer-cart-link' + '.shoptimizer-cart .cart-contents, .site-header-cart .cart-contents, .wcmenucart, .header-cart-link' ); /**