hide pre order when stock available

New Member
28 0 0

hi i want to ask something. how can I make this pre order text hidden if the item stock is available, for example when I switch variants with available stock the text is automatically hidden, and vice versa when I move to variants with non-available stock the text appears automatically
I hope someone can answer my question. thank you
fyi: I made this code myself, helped by my team

Screenshot from 2020-04-01 12-07-45.pngScreenshot from 2020-04-01 12-33-31.png

Shopify Partner
941 140 433

This is an accepted solution.

hii,  @mchmddiazz 
- There are 2 ways below to solve your problem.
1. to alter between preorder & add-to-cart button you should use select-callback-function which is quite popular in shopify.
2. you should get each variant quantity in variant loop and render the qty in html so that you can have qty of all variants in html. Now you should put a jquery event on select box. whenever user changes the variant, jquery script checks if there is qty>0 OR not from HTML and changes the name/design or button.

-I hope you understood. if not contact me on candisoft100@gmail.com
-like and mark as accepted solution.

Thank you

For Contact : candisoft100@gmail.com
Want to customize Shopify storefront? Check the PageFly app
75,000+ Active Shopify merchants. TOP5 best Shopify Apps.
3 0 1

THis, would be really nice to know...