Skip to Content

New J2Commerce 6.6.5 is out. Here is everything in the release.

See What’s New
Account
Enter the email address on your account.
Forgot your username?
Enter your password.
Forgot your password?

Or continue with

Open Public Category: Feature Requests Ticket #1063

Advanced cart CSS loads as critical asset despite hidden drawer

This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

J2Commerce

Version
J2Commerce v6

Conversation

Krzysztof Kuznowicz

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

Attachments

Zrzut ekranu 2026-09-23 115012.png
Zrzut ekranu 2026-09-23 115357.png
change.png
Adam Melcher Staff

Krzysztof,

I am creating an issue for the advanced cart css. I am very happy to see those screenshots. my own client sites have see changes scores of 95-99 in performance and 100 /100 for accessibility/seo without any other third party "optimization" extensions. We have another release coming up with more than 100 new PRs since the one last week that will continue to make this even better. Glad you decided to jump on J2 train... ;)

 

Adam

Krzysztof Kuznowicz

Hi Adam,

At this point my migration is basically 100% complete and everything in my store works as expected. Now I’m only fine tuning performance and some small optimizations. I used VirtueMart for almost a decade, and reaching a 90+ performance score there was practically impossible for my store. With J2Commerce I was already around 92 right after migration, even before deeper optimization work.Of course, I don’t want to get obsessed with chasing perfect 100 score ;-), especially on a real ecommerce site with google ads, Bing ads, pinterest, facebook and other third-party tracking scripts running. I use those tools actively, and they obviously affects performance scores. But honestly, I’m very impressed that with J2Commerce the store can still run almost at maximum performance while keeping all ecommerce functionality and external tracking active. 

Best,
KK

Krzysztof Kuznowicz

I'm slowly considering switching the store for architects https://szeregowe.pl/domy/kordian  - I also built this unique store website in Virtuemart a while back, and I think it can be done better and more efficiently in J2C, with more advanced features through integration with com_content and Joomla's advanced custom fields. This website operates on two domains, horyzont.com and szeregowe.pl -it will be difficult for me to convince the company’s management to consolidate the entire offering onto a single domain -it would be more efficient and better for SEO-currently, the two domains are cannibalizing each other, which only worsens the sites visibility..