Skip to main content

11 posts tagged with "FSE"

View all tags

WooCommerce Checkout Template Not Applied? Plugin Override

Β· 5 min read

After assigning the theme's checkout template to the Checkout page, the front end still renders WooCommerce's own structure β€” the theme template's heading and footer are nowhere in the output, while the body class reports the assignment as active.

Ran into this while building a minimal FSE WordPress theme for a client β€” a full-site-editing theme for corporate sites and lightweight e-commerce, with WooCommerce compatibility kept intentionally thin.

TL;DR​

WooCommerce hooks page_template_hierarchy at priority 1 and unshifts its own template slugs (checkout, cart) to the front of the hierarchy array, so the plugin template outranks nearly every candidate. Manually setting _wp_page_template on the page at that point only creates a second, conflicting signal β€” the body class reads the meta while the render follows the filter. The fix: delete the manually set _wp_page_template and let the hierarchy filter resolve.

Symptom: Body Class Says Theme Template, Render Is the Plugin's​

The template assignment in the page editor clearly names the theme's checkout template, and the body class faithfully shows page-template-checkout; the front-end output, however, is WooCommerce's page-content-wrapper β€” store notices and product content only, none of the heading and footer structure from the theme template.

The diagnostic marker is a single attribute: check whether the page's <main> element carries data-block-name="woocommerce/page-content-wrapper". If it does, WooCommerce's plugin template is what actually renders β€” the theme template has been sidelined, confirmed.

A symptom as self-contradictory as "body class says A, render shows B" almost always means two signal sources that never sync β€” and this machine has exactly one such pair.

Root Cause: page_template_hierarchy Cuts In at Priority 1​

WooCommerce's AbstractPageTemplate registers the filter in init():

add_filter( 'page_template_hierarchy', array( $this, 'page_template_hierarchy' ), 1 );

The callback is a one-line array_unshift: when the page matches the Checkout/Cart scenario, its own template slug goes to the front of the candidate array. The source comments state it plainly β€” priority 1 is deliberate, to run first; extensions using the default priority 10 line up behind it.

WordPress resolves templates by walking the array and taking the first file that exists. With checkout at the front: if the theme ships a template file of that name, the theme's wins; if not, resolution lands on WooCommerce's registered plugin template of the same slug (page-checkout.html, containing the woocommerce/page-content-wrapper structure).

Why does manually setting _wp_page_template backfire? That meta only feeds the body class and the editor display β€” it never enters the filter's resolution order. Its signal and the filter's result travel on separate tracks, producing the stalemate "assignment shows active, render doesn't move".

Fix: Delete _wp_page_template and Let the Hierarchy Filter Resolve​

Delete the manually set template meta and let WooCommerce's resolution mechanism run:

wp post meta delete <page_id> _wp_page_template

After deletion, body class and render agree again: whatever the filter resolves is what renders, and the body class reflects it. No template meta should be set explicitly on pages WooCommerce owns β€” the hierarchy filter is the authoritative signal.

A separate structural pitfall of the Cart template (placeholders and SSR rendering) lives at the same template layer and is worth checking alongside Checkout.

Caution

When verifying the fix, do not set _wp_page_template back "just to test" β€” that is the very source of the conflicting signal. The Cart page runs the same mechanism; if it shows the same assignment-ignored behavior, treat it identically, diagnosing with the same data-block-name="woocommerce/page-content-wrapper" marker.

FAQ​

How does WooCommerce win template resolution?​

It hooks page_template_hierarchy at priority 1, earlier than consumers at the default priority 10, and unshifts its template slug to the front of the hierarchy array. The WooCommerce source comments state this priority is intentional.

Why do the body class and the actual render disagree?​

Two separate signal sources: the body class is generated directly from the _wp_page_template meta, while the rendered template is decided by the hierarchy filter's array order. A manually set meta falls out of sync with the filter's result.

How do I confirm the plugin template is the one rendering?​

There is exactly one reliable marker: the data-block-name attribute on the main element. data-block-name="woocommerce/page-content-wrapper" means the plugin template renders; a theme-template main is built from the theme's own blocks and carries no such marker.

Is the Cart page taken over the same way?​

Yes. The same AbstractPageTemplate mechanism has two implementations, CartTemplate and CheckoutTemplate, covering both the Cart and Checkout pages β€” the same data-block-name marker diagnoses them.

CCLEE

Independent developer, 24 years in e-commerce, focused on grounding AI in real business scenarios.

Work with me

WordPress Block Theme Changes Not Taking Effect? FSE Guide

Β· 8 min read

Encountered these six issues repeatedly while developing WordPress Block Themes for clients. Each one took significant debugging time. This guide covers the root causes and provides ready-to-use solutions.

TL;DR​

Six issues ranked by frequency: file changes not applying (database cache overrides files), block nesting errors (unclosed comments), child theme content not rendering (missing post-content block), SVG icons disappearing (WP_Filesystem polluted by plugins), WP-CLI mail failures (SMTP plugins don't hook in CLI), and gallery images not loading (lazy loading conflicts with the slider). Each scenario includes copy-paste diagnostic commands.

WooCommerce Blocks Showing core/missing After Upgrade? Block Theme Troubleshooting Guide

Β· 7 min read

Ran into these four WooCommerce-specific issues while building Block Themes for clients. Each relates to how FSE architecture interacts with WooCommerce's block system. Documenting the troubleshooting process to help others working on WooCommerce theme development.

TL;DR​

Four common issues in WooCommerce Block Theme development: block rename causing core/missing (block names gained -block suffix after upgrade), product archive 404 after shop slug change (rewrite cache not flushed), template HTML mismatch with Gutenberg save (dynamic block validation failure), and Cart/Checkout templates not auto-assigning (manual assignment required). Each scenario includes copy-paste fixes.

Fixing 4 CSS Conflicts Between WooCommerce and FSE Block Themes

Β· 5 min read

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​

  1. Font size preset override: WooCommerce registers small/medium/large/x-large presets that override theme.json. Use custom slugs like h-1~h-6 to avoid conflicts.
  2. Font-size class hyphenation: has-h-1-font-size(48px) vs has-h1-font-size(20px). Hand-written HTML must use the hyphenated version.
  3. Contrast color inversion: --wp--preset--color--contrast is set to a light color (#f8fafc) by WooCommerce, making white text invisible.
  4. ul.products pseudo-elements: WooCommerce injects ::before/::after that break CSS Grid layout. Fix with display:none.

Fix FSE Block Theme Style Preview Single Color Block and Front Page Blank Canvas

Β· 4 min read

Encountered these two issues while developing a WordPress FSE Block Theme for a client. Here are the root causes and solutions.

TL;DR​

  1. Style variation palette/gradients replace rather than merge -- declaring only 1 color drops all others. You must include the complete list and only change what differs.
  2. Hardcoding patterns in front-page.html causes Site Editor blank canvas and prevents users from editing the layout -- switch to content-driven architecture.

Fix Hover Selector Penetration in Nested FSE Group Blocks

Β· 3 min read

Encountered this issue while developing a WordPress FSE Block Theme for a client: blog listing cards show text shifting on hover while the card border stays still. Here's the root cause and solution.

TL;DR​

Generic card hover selector .wp-block-columns .wp-block-column > .wp-block-group:hover matches the inner nested text group inside cards, causing text-only displacement. Fix: use .wp-block-post-template prefix to reset hover effects on inner groups.

Fix WooCommerce FSE Cart Block Blank Page and Product Image Collapse

Β· 4 min read

Encountered these two issues while developing a WooCommerce FSE Block Theme for a client: Cart Block renders a blank page when empty, and product cards collapse when no featured image is set. Here's the root cause and solution.

TL;DR​

  1. Cart Block requires explicit filled-cart-block and empty-cart-block inner blocks -- without them, empty cart renders nothing.
  2. FSE's post-featured-image block renders an empty string when no thumbnail exists, causing card height collapse. Fix with post_thumbnail_html filter to inject WooCommerce placeholder.

Fix Gutenberg Gradient Class Naming Change Causing Block Validation Failure

Β· 2 min read

Encountered this issue while developing a WordPress FSE theme for a client. Here's the root cause and solution.

TL;DR​

After a Gutenberg upgrade, the gradient CSS class naming convention changed from has-{slug}-gradient to has-{slug}-gradient-background. Hand-written Pattern HTML with old classes doesn't match Gutenberg's validation logic, causing Site Editor errors. The fix is to batch replace class names.

Fix FSE Group Block Layout Property Overriding Custom CSS

Β· 3 min read

TL;DR​

WordPress FSE Group blocks with layout property automatically generate is-layout-* CSS classes that have higher specificity than custom CSS, causing size settings to be ignored. Solution: 1) Use "layout":{"type":"default"} in block annotation to avoid extra layout classes; 2) Use !important in CSS to force override; 3) Key: Add padding: 0 !important to clear the Group block's default padding.

Fix WordPress FSE Theme Footer Text Visibility - WCAG Contrast Issue

Β· 3 min read

While developing a WordPress FSE enterprise theme for a client, I discovered the Footer block text was nearly invisible across multiple Style Variations. This post documents the complete fix process - from WCAG contrast diagnosis to introducing semantic colors and handling global styles override.

TL;DR​

Problem: FSE theme's contrast color token has conflicting semantics. In light themes, contrast β‰ˆ light gray β‰ˆ base (white), resulting in Footer contrast ratio of only 1.05:1.

Solution:

  1. Introduce surface semantic color for dark block backgrounds
  2. Delete override styles in wp_global_styles
  3. Add surface definition to all Style Variations

Result: Contrast ratio improved from 1.05:1 to 15.8:1 (WCAG AAA grade).