Fixing 4 CSS Conflicts Between WooCommerce and FSE Block Themes
While developing a WordPress FSE Block Theme with WooCommerce integration, I encountered 4 hidden traps where WooCommerce silently overrides theme styles. Each one was difficult to diagnose. Here are the root causes and solutions to help other FSE + WooCommerce theme developers.
TL;DR
- Font size preset override: WooCommerce registers
small/medium/large/x-largepresets that override theme.json. Use custom slugs likeh-1~h-6to avoid conflicts. - Font-size class hyphenation:
has-h-1-font-size(48px) vshas-h1-font-size(20px). Hand-written HTML must use the hyphenated version. - Contrast color inversion:
--wp--preset--color--contrastis set to a light color (#f8fafc) by WooCommerce, making white text invisible. - ul.products pseudo-elements: WooCommerce injects
::before/::afterthat break CSS Grid layout. Fix withdisplay:none.