hide pre order when stock available

Solved
Highlighted
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

0 Likes
Highlighted
Shopify Partner
798 124 412

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

Highlighted
Tourist
3 0 1

THis, would be really nice to know...

0 Likes