WooCommerce更新后导出至ShipStation订单日期显示01-01-1970求助
Hey there, I’ve helped debug a few similar issues post-WooCommerce updates, and that 01/01/1970 date (Unix timestamp 0) almost always points to a date parsing or timestamp retrieval failure. Since your database data checks out and LastModified is correct, let’s break down the most likely causes and fixes:
1. WooCommerce’s Order Date Field Logic Changed
Recent WooCommerce updates shifted away from direct access to old date strings (like $order->order_date) in favor of using WC_DateTime objects via methods like get_date_created(). If the ShipStation integration isn’t using these new methods, it might be pulling an empty or invalid value that defaults to timestamp 0.
- Test the date retrieval: Add this quick snippet to your theme’s
functions.php(backup first!) to verify what date data WooCommerce is returning:
If the timestamp here is 0 or the formatted date is wrong, the issue is with WooCommerce’s internal date handling. If it’s correct, the problem lies in how the ShipStation feed formats this data.add_action('woocommerce_after_order_details', 'debug_order_date_data'); function debug_order_date_data($order) { echo '<strong>Debug Order Date:</strong><br>'; echo 'Created Date (Formatted): ' . $order->get_date_created()->format('m/d/Y H:i') . '<br>'; echo 'Created Timestamp: ' . $order->get_date_created()->getTimestamp() . '<br>'; }
2. Outdated ShipStation Integration Plugin
If you’re using the official WooCommerce ShipStation Integration plugin, it might not be updated to support the latest WooCommerce date object changes. Old versions often rely on deprecated fields that no longer populate correctly.
- Fix: Head to your WordPress plugins page, check for updates to the ShipStation plugin, and install the latest version. If that doesn’t work, try temporarily deactivating and reactivating the plugin to reset any cached settings.
3. Custom Push Code Needs Date Format Adjustment
If you’re using a custom script to push orders to ShipStation, you’ll need to update how you fetch and format the order date to match WooCommerce’s current structure.
- Bad (old way):
$order_date = $order->order_date; // Deprecated in newer WooCommerce versions - Good (new way):
This ensures you’re pulling the correct, timezone-aware date data and formatting it exactly as ShipStation expects.// Get the WC_DateTime object and format it to match ShipStation's required mm/dd/yyyy HH:mm format $order_date = $order->get_date_created()->format('m/d/Y H:i');
4. Timezone Mismatch Causing Parsing Errors
Even if your database data is correct, a mismatch between WooCommerce’s timezone settings and ShipStation’s can cause date values to be parsed as invalid, leading to the 1970 fallback.
- Check settings:
- Go to WooCommerce → Settings → General and confirm your store timezone is set correctly.
- Log into ShipStation’s admin and verify its timezone matches your WooCommerce store.
- Double-check your
wp_optionsdatabase table fortimezone_stringandgmt_offsetvalues—make sure they align with your store settings.
5. Conflicting Plugins Altering Order Date Metadata
Some third-party plugins (like order scheduling or custom date tools) might add custom metadata fields for order dates. WooCommerce updates could cause the ShipStation integration to accidentally pull these custom fields instead of the native order creation date.
- Debug:
- In your
wp_postmetatable, look for metadata entries for the problematic order ID (search forpost_id = [your-order-id]). - Check for fields like
_custom_order_dateor similar—if any have a value of0or an invalid date, temporarily disable the plugin that adds this field and test a new order push.
- In your
Start with updating the ShipStation plugin and testing the date retrieval snippet—those are the quickest wins for this issue!
内容的提问来源于stack exchange,提问作者jnayer

