Fix single product layout conflicts with WooCommerce CSS

WooCommerce's layout CSS fought Bootstrap's grid in three ways:

1. Float-based two-column layout (width: 48% + float) on div.images
   and div.summary squeezed content inside our col-lg-6 columns.
   Reset with float: none; width: 100%.

2. Nested content wrapper (.container + #primary + <main>) from
   woocommerce_output_content_wrapper doubled up on the parent
   theme's existing .container. Remove the hooks entirely.

3. Sale badge (position: absolute; top: -.5em; z-index: 9) escaped
   the image column and blocked breadcrumb clicks. Override to
   top: 0.5em; z-index: 1 and use gx-* (horizontal-only gutters)
   to avoid negative margin-top on the .row.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-28 18:25:01 +01:00
parent 7fda8e1962
commit c5f8e88ee4
3 changed files with 35 additions and 4 deletions

View File

@@ -271,6 +271,22 @@ function wc_bootstrap_remove_default_sidebar(): void {
}
add_action( 'init', 'wc_bootstrap_remove_default_sidebar' );
/**
* Replace WooCommerce's content wrapper with a no-op.
*
* The parent theme's page shell already wraps content in a .container,
* so WooCommerce's default wrapper (another .container + #primary + <main>)
* creates a double-nested container that constrains width. Remove it and
* let the parent theme handle the outer layout.
*
* @since 0.1.0
*/
function wc_bootstrap_remove_content_wrappers(): void {
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
}
add_action( 'init', 'wc_bootstrap_remove_content_wrappers' );
/**
* Prevent the parent theme from rendering WooCommerce pages.
*