A user wants to hide the grayed-out “Add to Cart” (ATC) button and payment options on out-of-stock product pages, showing only a “Notify Me” button for restock alerts. They want to avoid code that briefly displays these elements before hiding them.
Three solutions were provided:
Liquid conditional wrapper: Wrap payment option code with {% if product.available %} to prevent rendering when unavailable
CSS targeting disabled elements: Add CSS to base.css that hides disabled buttons:
Theme.liquid modification: Insert conditional code above the </body> tag to control visibility based on product availability
All solutions target the same outcome through different approaches—either preventing elements from rendering (Liquid conditionals) or hiding them via CSS (styling disabled states). The CSS approach is simpler to implement but may still briefly load elements before hiding them, which the user wanted to avoid.
Summarized with AI on October 26.
AI used: claude-sonnet-4-5-20250929.
Hi! I am wanting to hide the ATC button and the payment options that show grayed out on the product page when the items are out of stock. I would like for it just to show my Notify Me button for instock alerts. Can anyone tell me how I can do this officially? I have tried code before that still loads the ATC and payment options and then quickly hides them. Trying to avoid that.