Home Forums WoodMart support forum Variable product out of stock but Add to cart button still visible

Variable product out of stock but Add to cart button still visible

Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • #719503

    laptoria.de
    Participant

    Hello WoodMart Support,

    we have an issue with variable products and stock status on the single product page.

    For a variable product, the parent product has stock management enabled, stock quantity is 0, and backorders are not allowed. We also tested setting all variations to stock quantity 0 and backorders not allowed.

    However, on the single product page the “Add to cart” button is still displayed as active, although the variations are greyed out and the product cannot actually be added to the cart.

    We are using a WoodMart Single Product Layout with Elementor and the “Product add to cart” element. We also tested disabling AJAX add to cart, sticky add to cart, Buy Now button, Quick Shop for variable products, and linked variations, but it did not solve the issue.

    The issue started after recent updates, possibly Elementor/WooCommerce/WoodMart related.

    Example product:
    https://laptoria.de/shop/hp-elitedesk-800-g4-sff-i5-gt730/

    Please see the attached screenshots for examples of the issue and our current settings.

    Could you please advise how to make WoodMart hide or disable the Add to cart button when the parent variable product stock is 0 / out of stock?

    Thank you.

    Attachments:
    You must be logged in to view attached files.
    #719521

    laptoria.de
    Participant

    Additional information: even after deleting all variations from the variable product, WoodMart still displays the sticky bar with “Select options” and “Buy now” buttons. So the issue does not seem to be caused by variation stock settings only. It looks like the WoodMart sticky add-to-cart / product add-to-cart element is displayed for variable products even when no variations are available or the parent product stock is 0.

    #719546

    Serg Sokhatskyi
    Keymaster
    Xtemos team

    Hello,

    To help diagnose this issue, could you please test with a default theme? This will help us determine if the problem is theme-related or caused by another factor.

    Steps:
    1. Temporarily switch to the default WordPress or Storefront theme (WooCommerce’s official theme)
    2. Test the functionality
    3. Let us know if the issue persists

    Important: Make a backup before switching themes, and don’t worry—your WoodMart settings will be preserved.

    Best regards

    #719610

    laptoria.de
    Participant

    Hello,

    we tested the same product on a cloned website with the Storefront theme.

    With Storefront, everything works correctly: the product is shown as out of stock and the Add to cart button is not displayed.

    With WoodMart active, the Add to cart / Select options button is still displayed for the same out-of-stock variable product.

    Example product:
    https://laptoria.de/shop/hp-elitedesk-800-g4-sff-i5-gt730/

    The parent product has stock management enabled, stock quantity 0, and backorders disabled. We use a WoodMart Single Product Layout with Elementor and the “Product add to cart” element.

    Please see the attached screenshot from the Storefront test.

    Could you please check why this happens with WoodMart?

    Best regards

    Attachments:
    You must be logged in to view attached files.
    #719612

    Serg Sokhatskyi
    Keymaster
    Xtemos team

    To proceed and diagnose this accurately on your setup, we need:
    – Temporary WordPress admin access. Please provide the site URL, username, and password via the forum’s Private Content field.
    – Please temporarily disable all plugins (keep the theme active) so we can test in a clean environment. Let us know once this is done.

    After that, we’ll check the single product page and update you with the next steps.

    Kind regards,
    XTemos Studio

    #719615

    laptoria.de
    Participant

    Hello Serg,

    thank you for your reply.

    Unfortunately, we cannot disable all plugins on the live website, because the shop is currently active and we are receiving orders. Disabling payment, checkout, Germanized, shipping or stock-related plugins on the live site could break the ordering process.

    We can provide temporary WordPress admin access to a staging copy of the website instead. On staging, we can disable plugins and keep WoodMart active so you can test the issue in a clean environment without affecting live sales.

    Would that be acceptable for your investigation?

    Best regards

    #719618

    laptoria.de
    Participant

    we have provided the temporary WordPress admin access details in the forum’s Private Content field.

    The site URL,

    #719620

    Serg Sokhatskyi
    Keymaster
    Xtemos team

    Hi,

    Thank you for providing your staging website. Please send us your server authentication data as well https://gyazo.com/9827f326a99017d14ea79da957969e82

    Kind Regards

    #719621

    laptoria.de
    Participant

    Website access

    #719690

    laptoria.de
    Participant

    were you able to log in with the WordPress admin access we provided?

    #719695

    Serg Sokhatskyi
    Keymaster
    Xtemos team

    Hi there,

    This behavior occurs because the WooCommerce setting “Hide out of stock items from the catalog” is enabled, and together with our swatches logic it can keep the add-to-cart section visible on variable products even when everything is out of stock. To make it work the same way as in the default theme, add the following snippet to your child theme’s functions.php:

    add_action( 'init', function (){
    	remove_action( 'woocommerce_variable_add_to_cart', 'woodmart_show_out_of_stock_variation_products', 20 );
    } );

    After adding this, the add-to-cart area will no longer be shown for variable products that are out of stock.

    Kind regards,
    XTemos Studio

    #719704

    laptoria.de
    Participant

    We added the code you provided, but unfortunately it did not work on our side. Nothing changed, the Add to cart / Select options area is still visible.

    Kind regards

    #719705

    laptoria.de
    Participant

    the snippet partially worked: the main add-to-cart area is now hidden and the product shows the out-of-stock label.

    However, the sticky add-to-cart bar at the bottom is still displayed with “Select options” and “Buy now”.

    Could you please also provide the correct fix to hide the sticky add-to-cart bar for out-of-stock variable products?

    Kind regards

    #719732

    Serg Sokhatskyi
    Keymaster
    Xtemos team

    Hello,

    Please add the following code to Theme Settings > Custom CSS > Global:

    .single-product:has(.single-product-content.outofstock) .wd-sticky-btn {
    	display: none;
    }

    Let us know if this resolves the issue.

    Best regards

    #719781

    laptoria.de
    Participant

    Hello,

    we added the CSS code you provided, but it does not work on our side. Nothing changed.

    The sticky add-to-cart bar is still visible when scrolling down.

    Kind regards

    #719809

    Serg Sokhatskyi
    Keymaster
    Xtemos team

    Try to replace that custom CSS with the following

    .single-product:has(.single-product-page.outofstock) .wd-sticky-btn {
        display: none;
    }
    
    @media (min-width: 769px) {
        .single-product.wd-sticky-btn-on:has(.single-product-page.outofstock) {
            padding-bottom: 0;
        }
    }
Viewing 16 posts - 1 through 16 (of 16 total)