Having an issue with a client website where products are randomly displaying
“This product is currently out of stock and unavailable.”
The thing is that we don’t have inventory tracking turned on, all products should be in stock all the time.
When I go into the WordPress admin and click the update button for the product (without changing anything) and then the message goes away and the “Add to Cart” button displays as it should. Unfortunately, the issue repeats itself on these items in the future and to fix it I have to update the product again (also clicking update in the WooCommerce settings temporarily solves the problem).
I need to find a way to fix this problem permanently so it doesn’t revert itself.
- Using WordPress 3.9.1
- WooCommerce 2.1.12
- PHP 5.3.10 (also tried locally w/ 5.5.10)
What I’ve tried
- Removing all plugins but WooCommerce
- Changing themes (tried all standard WordPress themes and a few WooThemes themes to no avail)
- Updated WooCommerce (it was v 2.1.5)
- Manually inserted to wp_postmeta adding the meta key
_manage_stockand set it to
no(as observed in some of the working products we have)
- Manually inserted to wp_postmeta adding the meta key ‘_stock’ and set it to
0(as observed in some of the working products we have)
- Compared the postmeta of the product before and after clicking the update button to observe if anything had changed that would cause the problem…nothing
- No caching is turned on
- Used XDebug to track the
When debugging I noticed that in products that were working the
$available_variations variable contained 2 arrays filled with product information, however on the products that didn’t, it was an empty array (which results in the out of stock message being displayed as served by
variable.php). Clicking the update button and then tracking the variable shows the information correctly.
Honestly at this point I’m at a loss. I think the issue is somewhere in either of the classes, but I can’t tell.
Has anyone else had issues with this? Any way around this issue so I don’t have to keep updating products for this client.
Link to product that is out of stock (as of posting) http://highlandsministriesonline.org/product/basement-tapes/resentment-in-the-church-135/
Link to product that is displaying correctly http://highlandsministriesonline.org/product/basement-tapes/bt0111-church-at-corinth-i/
Potential Next Steps My next thought if I cant get this resolved is to write a script that will go through and update each product on the website on a nightly basis (since the temporary fix seems to work for at least 24 ours). Though if I can save some of my time I’d rather not if someone else has been able to solve this issue permanently.