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
Solved! Go to the solution
This is an accepted solution.
- 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 firstname.lastname@example.org
-like and mark as accepted solution.