Hi,
I have a condition set up based on the WooCommerce stock level of products.
When a product is in stock (gte 1), the 'Add to Basket' button shows.
When a product is out of stock (eq 0) a 'Join Waiting List' button shows instead.
The condition is working fine until the stock level changes from 1 to 0.
When this happens nothing displays, and it just seems to break.
If you open up the product and re-save it, everything works fine again.
You can see examples below of the issue.
The list has random products when you scroll down that don't display a button: hidden link
If you click into one of these products the template is empty: hidden link
This is what should display: haunted-houses-co-uk.stackstaging.com/event/ford-green-hall-fri-21st-dec-2018/
Any thoughts?
Thanks
James
Hi, it appears that the Upcoming Events page is restricted because I'm shown a 404 Page not found error. I'm also not able to see the actual code in your conditional, so I can't validate the syntax. If you're able to provide login credentials in the private reply fields here, I will be glad to take a closer look.
Hi, I can see that things are breaking down here because the wpv-post-field shortcode for "_stock" doesn't return anything on the blank-looking Product pages. No zero is returned, and the conditionals are incomplete because they do not allow for a null value, which is apparently possible somehow. Conditionals that test a null value are tricky, so I usually add a character to the test string and test the result. The result should be the same as the extra character. Like this:
[wpv-conditional if="( ('a[wpv-post-field name="_stock"]' eq 'a') OR ('[wpv-post-field name="_stock"]' eq '0'))"]
I would update all the conditionals that test if the _stock value is eq '0' using the code above as a guide. Then let me know if the problem is not fully resolved and I can take a closer look.