You've already forked wc-bootstrap
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:
@@ -209,10 +209,13 @@
|
||||
|
||||
/* ==========================================================================
|
||||
Sale Badge
|
||||
Positioning for the sale overlay badge on product cards.
|
||||
Position inside gallery area, not overlapping breadcrumb.
|
||||
WooCommerce sets top: -.5em which bleeds above the containing block.
|
||||
========================================================================== */
|
||||
|
||||
.onsale {
|
||||
.woocommerce span.onsale {
|
||||
top: 0.5em;
|
||||
left: 0.5em;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
@@ -263,6 +266,18 @@
|
||||
border-radius: var(--bs-border-radius);
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Single Product Layout
|
||||
Reset WooCommerce's float-based two-column layout for single product pages.
|
||||
Bootstrap's row/col-lg-6 grid handles the layout instead.
|
||||
========================================================================== */
|
||||
|
||||
.woocommerce div.product div.images,
|
||||
.woocommerce div.product div.summary {
|
||||
float: none;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Variation Selectors
|
||||
Spacing for variable product attribute dropdowns.
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -34,9 +34,9 @@
|
||||
<div id="product-{{ product_id }}" class="{{ product_class }}">
|
||||
|
||||
{# Two-column layout: images left, summary right #}
|
||||
<div class="row g-4 g-lg-5 mb-5">
|
||||
<div class="row gx-4 gx-lg-5 mb-5">
|
||||
{# Left column: Sale flash + Product images #}
|
||||
<div class="col-lg-6">
|
||||
<div class="col-lg-6 position-relative">
|
||||
{{ do_action('woocommerce_before_single_product_summary') }}
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user