• Resolved danielmoorehbd

    (@danielmoorehbd)


    Hi,
    This issue has been a real head scrathcer, just wondering if anyone else has come across it before or could guide me towards a soultion.

    Our Stock (Low/Out of Stock) Notifications have suddenly stopped sending. They don’t appear in our email output log. This is strange as they used to and our other emails, such as orders and New User notifications are still outputting as normal.

    Just wondered if anyone had any guidance on how to resolve this?

    Kind Regards

Viewing 9 replies - 1 through 9 (of 9 total)
  • A few ideas, forgive me if some of these are too basic:

    • In the inventory settings, I’m assuming stock management is on? And the notifications are both enabled? And there’s no typos/whitespace in the email address?
    • Is there any custom code or plugins that would be modifying the woocommerce_email_recipient_low_stock (or no stock) filter?
    • Is there any custom code or plugins that would be handling woocommerce_email_headers/woocommerce_email_attachments? I could imagine having code that works for most of the emails, but crashes when handling those two because they’re not the usual fully-templated WC_Email-based ones.

    I guess you could log a debug message when woocommerce_email_recipient_low_stock was called. It’s called right as the email is attempting to send, so it would let you know whether it was even attempting to do so.

    Thread Starter danielmoorehbd

    (@danielmoorehbd)

    Hi @mailmechanic,

    Thank you for your reply.

    I can confirm Inventory settings Sock management is on, notifications are enambed and 3 email addresses are in there, this was not touched since it worked last.

    As for custom code, I doubt there is as I’ve never amended the woocommerce_email_recipient_low_stock hook. That said, it could be a plugin, question is, which one and why…

    I’ve checked the logs and cannot find this hook, or any mention of stock, anywhere, how would you recomend setting up a debug for this hook?

    Kind Regards

    A quick approach would be to download your wp-content/plugins and wp-content/themes and to a text search on them for those hooks. Or you could *carefully* (ideally on a staging site) apply a snippet like while reducing stock:
    https://www.mootpoint.org/blog/debug-wordpress-by-logging-hook-calls/

    Or there’s the usual (but tedious) approach of disabling plugins until you find the plugin at fault. The standard Health Check plugin can help with that so there’s minimal disruption to customers:
    https://www.ads-software.com/plugins/health-check/

    Hopefully it’s not some other cause, those were just the ones that came to mind.

    Thread Starter danielmoorehbd

    (@danielmoorehbd)

    Thanks @mailmechanic,

    I’ll give that a try and look at the results in the morning!

    This is odd though, I changed the SMTP settings yesterday to something else before changing it back and 1 of these emails did make it through, but it has stopped again now we’ve let it settle… – just to add to the complexity!

    Kind Regards

    Thread Starter danielmoorehbd

    (@danielmoorehbd)

    Some notes today:
    – Searching through the wp-contents folder for the hook woocommerce_email_recipient_low_stock only turned up the 1 result in the WooCommerce plugin itself, otherwise, nothing else there.

    – I have updated WooCommerce to the latest version just now so hopefully this will resolve the issue! I’ll leave it overnight to brew.

    Would it make any difference the fact that the majority of our stock updates, including depletion, are happening over an API? (So a prodct can hit low/out of stock without web purchase, technically). – Note this has never caused an issue before…

    Kind Regards

    The one email getting through on the SMTP change is interesting. You mentioned checking the email output log, is that through your mail provider or something like WP Mail Logging? I’d suggest WP Mail Logging if not, just so you can rule out that it’s something on the delivery side.

    I do wonder if it’s an issue with it happening over the API, I could imagine the notification working differently there. Would it be easy to test triggering a low-stock notification with a regular order on the front end?

    Thread Starter danielmoorehbd

    (@danielmoorehbd)

    Hi @mailmechanic,

    The email log is via the Mail Log plugin in WordPress, what is actually sent is what we see on the log, interesting that I never see any attempts, which tells me it isn’t being attempted after the API call.

    I’ve manually updated the stock levels in wp-admin but that doesn’t work either so we have one of 2 scenarios here,
    1) It only emails out when an order is placed
    or
    2) The SMTP change is the sole reason to trigger, we just got lucky with timing!

    What I can’t understand is this, this was working perfectly fine until a few weeks ago, but no work, plugin installs, or updates were made around the time it stopped… I’m beginning to wonder if there is something to address in CRON?

    I’m open to any suggestions of what to do next!

    Yeah, I have no idea/explanation about why it changed without updates/installs. Maybe someone more familiar with Woo’s stock management code will chip in with some ideas.

    If trying to distinguish between the two scenarios you mentioned doesn’t lead anywhere, I’d probably start tracing through the code involved in inventory reduction, trying to figure out where things are going wrong (either with Xdebug or adding logging functions to the hooks that fire along the way).

    Thread Starter danielmoorehbd

    (@danielmoorehbd)

    And is if by magic, everything is working perfectly today… as if it never went wrong? …

    I’ll close this for now and come back if it returns…

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Low/Out of Stock Email notifications have stopped working’ is closed to new replies.