• When a variation is mapped to a Product Bundle, the stock quantity is not displayed on the frontend product page, even when the bundle’s component products all have stock management enabled with quantities set.

    Root cause

    The variation_get_manage_stock filter (in product-bundles-variation-bundles.php) returns <code class=””>$variation_bundle->get_manage_stock(). Since a bundle product does not manage its own stock — its components do — this value is <code class=””>false. As a result, <code class=””>WC_Product_Variation::managing_stock() returns <code class=””>false, <code class=””>get_availability_text() produces an empty string, and the availability_html returned for the variation via <code class=””>get_available_variation() is blank. The stock quantity filter (woocommerce_product_variation_get_stock_quantity) correctly returns the inherited bundle stock quantity, but this value is never used because <code class=””>managing_stock() has already returned false.

    Steps to reproduce

    1. Create a Product Bundle with two component products, both with stock management enabled and quantities set.
    2. Create a variable product and map one variation to that bundle using the Variation Bundles field.
    3. Visit the product page and select the mapped variation from the dropdown.
    4. No stock quantity is displayed, despite the bundle’s <code class=””>get_bundle_stock_quantity() returning a valid figure.

    Suggested fix

    In the variation_get_manage_stock filter, rather than returning <code class=””>$variation_bundle->get_manage_stock(), check whether any of the bundle’s component products manage stock. If they do, return <code class=””>true. The admin variation form context check (did_action comparison) should be preserved to avoid affecting the backend UI.

You must be logged in to reply to this topic.