The advancedcart plugin loads its full advanced_cart.css globally as a critical stylesheet, even though the cart drawer is hidden and may never be opened by the user. It would be better to load only a minimal critical CSS needed to keep the drawer hidden, and defer/preload the full cart CSS until the user interacts with the cart or adds a product. In /plugins/j2commerce/app_advancedcart/src/Extension/AppAdvancedcart.php
// this line is wrong: The full CSS for the hidden drawer is marked as a critical resource.
$wa->registerAndUseStyle( 'plg_j2commerce_app_advancedcart.css', 'media/plg_j2commerce_app_advancedcart/css/advanced_cart.css');
// Better: Load only critical CSS immediately; load the full CSS only after interaction or preload.
$wa->registerAndUseStyle('plg_j2commerce_app_advancedcart.critical', 'media/plg_j2commerce_app_advancedcart/css/advanced_cart_critical.css');
$wa->registerStyle('plg_j2commerce_app_advancedcart.css', 'media/plg_j2commerce_app_advancedcart/css/advanced_cart.css');
In my modified shopping cart, I implemented this a little differently due to the specific nature of my store, but the result is similar, and this change improved my website's performance by a few percent
$wa->addInlineStyle("
/* Minimal critical CSS hiding the cart drawer before the full stylesheet is loaded. */
");
$wa->addInlineScript("
/* Preload the full cart CSS after page load. Apply the full cart CSS on cart interaction, add-to-cart action, or after a safe fallback timeout */
");
I'd also like to add that the migration from Virtuemart to J2commerce has had a hugely positive impact on my store's performance - as shown in the attached charts. :)
best regards
KK