Skip to content

SUMNIMA

Theme Documentation & Community

  • Documentation
  • Community
  • Support

GURANSH

⌘K
  • Theme Features
    • Theme introduction
    • Header & Footer
      • Top Section
      • Announcement Slider
      • Categories
      • Subscribe Section
      • Footer Color & Logo
      • Subscribe Popup
      • Footer addition link
      • Brands(navigation)
    • Homepage & Pages
      • Lenis – smooth scroll
      • Carousel
      • Blog slider
      • Shop By Collection(category)
      • Background (New, Featured & Popular Products)
      • Dynamic background – essence
    • Product & Cart
      • Accordion
      • unit
      • Call for Price
      • Inquiry (Ask a Question)
      • Almost Gone! Low Stock!
      • Product Swatch,Variant Images
      • Product video (APNG)
      • auto coupon apply
      • Cart Celebration
      • Video/PDF Lightbox
      • Product tooltip
      • Vimeo
      • Variant Options with Custom Fields
      • Price (add to cart)
      • Advanced Cart Drawer
      • Advanced Cart Drawer with Related
    • Skeuomorph Style
    • Add-ons
      • Featured in (Logo slider)
      • Marquee
      • Payment icons
      • Review Slider
      • Social icons
    • Page Builder
      • dark
      • four-two
      • three-two
      • instagram
    • Addition Tweak
      • Missing Logout link
    • Bugs
      • out of stock – add to cart
  • Changelog
    • 1.1.0
  1. Home
  2. Docs
  3. GURANSH
  4. Theme Features
  5. Bugs
  6. out of stock – add to cart

out of stock – add to cart

JavaScript method

If you’re facing an out-of-stock product with the Add to Cart button still visible, copy and paste the JavaScript below into your site script manager.

<script> 
const style = document.createElement('style');
style.textContent = `
  .add-to-cart-wrapper[productoutofstock] {
    display: none !important;
  }
`;
 
const footer = document.querySelector('footer');
if (footer) {
  footer.appendChild(style);
} else { 
  document.body.appendChild(style);
}
</script>

Proudly powered by WordPress