Fixing a Delivery Bug on My WooCommerce Site

I recently received an email from a customer who noticed her order had been marked for pickup, even though she had selected delivery at checkout. I promptly responded, thanking her for bringing it to my attention and letting her know I would investigate on the backend. I reassured her that her order would still be delivered on time. After looking into it, I realized the issue stemmed from custom code written for the Orderable plugin.

Originally, the code forced all orders to use a Sunday pickup date—either for the current week or the next—based on when the order was placed. But now that I’ve added a delivery option (which happens on Mondays), that logic needed to change.

Here’s how the scheduling should work:

  • Pickup: Always on Sunday
  • Delivery: Always on Monday
  • Order window logic:
    • Orders placed Sunday–Tuesday = meals go out that same week
    • Orders placed Wednesday–Saturday = meals go out the following week

After a few rounds of trial and error with ChatGPT, I found a code solution that correctly handles both Sunday pickups and Monday deliveries. I first tested the fix in my staging environment by placing a test order. The confirmation page showed the correct delivery status, and no unwanted switch to pickup.

Once confirmed, I deployed the change to the live site and tested again. Everything worked as expected-issue resolved!

Similar Posts