I have been researching and testing methods of ending a sale in Woocommerce on a specific day – whether you set the date of the sale ON the LAST DAY of the sale or on the NEXT DAY of the sale.
The assumption is that if you have set your Timezone in WordPress to your correct timezone (US – Central here) then the sale would end at Midnight of the last day. So if my sale ends on 1/24/2020 then I would set the sale date to end ON 1/24/2020 and when Midnight hit, the sale would end. I have not seen this to be the case though. I have seen mixed results of this, and WizzyWigWebDesign has also seen mixed results in their testing.
Here is what I’ve tested and recommend to fix the Woocommerce sales dates:
- Add your sale prices to the items
- Add your sales dates starting and ending on the days of your sale – needed because the values needed are not generated until these are added
- Search in phpMyAdmin > wp_postmeta using the WordPress post_id generated for your product
- Find the Meta Value for the sale in “_sale_price_dates_from” & “_sale_price_dates_to”
- Generate new timestamps for the exact times you want the sale to start and end > TimeStampConvert.com
- Replace the values for those items using the below Update command
- Simulate query first – check that the number of lines to be updated is the same as the
- Hit Go if the number is correct
SQL Command to update timestamps for Woocommerce sales:
UPDATE 'wp_postmeta' SET 'meta_value' = **NEW TIMESTAMP##** WHERE 'wp_postmeta'.'meta_value' = **OLD TIMESTAMP##**;
Example of completed command:
UPDATE 'wp_postmeta' SET 'meta_value' = 1573106459 WHERE 'wp_postmeta'.'meta_value' = 1573106400;