PHP Cart Content or SSR
-
Can the table (cart items and totals) be rendered in the initial HTML instead of being generated by React js after page loaded?
-
Hi @selimkoc,
I understand you are looking to have the cart table and totals rendered directly in the initial HTML instead of being built by React once the page loads. This is a great question, and I can see how having the cart content available server side could be helpful for performance and SEO needs. I will be happy to guide you on this.
WooCommerce Blocks currently handle the Cart and Checkout pages using client side rendering through React. These blocks do not provide an option to switch them to server side rendering. To have the cart table and totals rendered in the initial HTML, you would need to use the Classic Shortcode based Cart page instead, since shortcodes are generated by PHP on the server side. You can learn more about configuring the Cart and Checkout using the Classic Shortcodes here https://woocommerce.com/document/woocommerce-shortcodes/page-shortcodes/#cart and here https://woocommerce.com/document/woocommerce-shortcodes/page-shortcodes/#checkout.
If you prefer to keep the Block version but want more flexibility in how Cart data is surfaced, sharing your use case as a feature request would also be welcome. You can do here https://woocommerce.com/feature-requests/woocommerce/.
Let me know how things go or if you want help switching back to the classic Cart and Checkout pages.
Hi @lovingbro,
Thank you very much for detailed explanation.
I added a feature request for this.
Please do this on Chrome:
F12 > Network > No Cache & 4G Slow Throttling and load your favorite WooCommerce store’s cart page from Showcase page for example https://danosseasoning.com/cart/ did not load in 20 seconds, here a test from U.S. https://speedvitals.com/report/danosseasoning.com/zdaKAy
I think from architectural point of view, the current way is quite slow especially for mobile users. I know junior front-end devs want to use “modern stack” but user experience is much more important.
For now, I switched on Classic Cart.
Thanks
Hi Selim,
Thank you for sharing your detailed follow‑up and for taking the time to test performance under throttled conditions. I completely understand your concern, slow cart loads can be frustrating, especially for mobile users where every second counts.
I tested as you suggested, and the performance is about the 20 second range.
You’re right that the current Cart and Checkout blocks rely on client‑side rendering, which can introduce delays compared to server‑side shortcodes. Switching back to the Classic Cart is a solid workaround for now, and I’m glad you’ve already made that adjustment.
I appreciate that you’ve submitted a feature request. In the meantime, if you’d like to optimize further, you might consider:
- Reviewing caching and CDN integrations to ensure assets are delivered as quickly as possible.
- Testing with different performance plugins or server configurations and a lightweight theme to reduce initial load time.
Thanks again for raising this thoughtfully. Please keep us posted on how your Classic Cart setup performs, and don’t hesitate to reach out if you’d like guidance on fine‑tuning performance further.
It’s been a while since we heard back from you for this reason we are closing this thread.
If WooCommerce has been useful for your store and you appreciate the support you’ve received, we’d truly appreciate it if you could leave us a quick review here:
The topic ‘PHP Cart Content or SSR’ is closed to new replies.