1. Home
  2. /
  3. Docs
  4. /
  5. Conditional Shipping for ...
  6. /
  7. Pro Features
  8. /
  9. Conditional Shipping by D...

Conditional Shipping by Date and Time in WooCommerce

FjeV3Nh9xKZnxmbUoeN2XvRCxolwTJFMX8S9VeNiKN DWNFeTK3koAj Cw5wmlgMNxHf5y FoiC91lj7hDhd5PbFGBuNPuhoLJQ4MYxXC53CqKurs2ql3L2PqU 0tfN2V86gKnCQaaiKfuF3JQRGPg4

The Conditional Shipping for WooCommerce plugin offers a feature to control shipping method availability based on the current date and time. This functionality allows you to create time-bound promotions or restrict shipping options during specific periods.

Understanding Date/Time Conditions

  • Format: Dates and times must be specified in a format understandable by the PHP strtotime () function. This function converts human-readable dates and times into timestamps for internal processing.
  • Date Range: You can define a date range using a hyphen () to separate the “from” and “to” times. For example, “2024-05-10-10:00:00-2024-05-12-18:00:00” represents a time frame from 10:00 AM on May 10th, 2024, to 6:00 PM on May 12th, 2024.
  • Multiple Ranges: Separate multiple date ranges using a semicolon (;). The plugin checks the conditions sequentially and stops processing once a matching date and time are found. For instance, “10:00:00-12:00:00;16:00:00-18:00:00” defines two separate time ranges within the same day.

Example: Free Shipping During Business Hours

  • Goal: Offer free shipping during weekdays (Monday to Friday) between 9:00 AM and 5:00 PM.

Configuration

  • Enable the condition for the desired shipping method (e.g., Free Shipping).
  • Set the date range as: “Monday-09:00:00-Friday-17:00:00”. This leverages the flexibility of strtotime() to understand weekdays without specifying specific dates.

Additional Considerations

  • Time Zone: Ensure your WooCommerce settings reflect the correct time zone to align with your desired scheduling.
  • Real-time Updates: The shipping method availability reflects the current date and time automatically.
  • Date Range Limitations: While the format allows for future dates, using past dates or creating nonsensical time ranges (e.g., starting after the end time) might not produce the expected behavior.

In Conclusion

By leveraging the Date/Time condition within Conditional Shipping for WooCommerce, you can create dynamic shipping strategies based on specific timeframes. This empowers you to implement strategic promotions (e.g., free shipping during peak hours), manage fulfillment processes during operational hours, or temporarily restrict shipping options during holidays or non-business days.