Absolute value for gmt_offset in scheduled sales

In the event that you choose a -GMT value, the values are incorrect in some instances. For examples, if we choose a -7 GMT value, the gmt_offset will evaluate to '-7'.

On line 309, $ve will equal '+'.

On line 312, previously, $ve . get_option( 'gmt_offset' ) would evalute to '+-7'.
This commit is contained in:
Matt Miller 2017-08-25 15:25:39 -07:00 committed by GitHub
parent 3b3ceebc1f
commit 34b64764c7
1 changed files with 3 additions and 2 deletions

View File

@ -307,8 +307,9 @@ class WC_Install {
wp_clear_scheduled_hook( 'woocommerce_tracker_send_event' );
$ve = get_option( 'gmt_offset' ) > 0 ? '-' : '+';
wp_schedule_event( strtotime( '00:00 tomorrow ' . $ve . get_option( 'gmt_offset' ) . ' HOURS' ), 'daily', 'woocommerce_scheduled_sales' );
$abs_offset = absint( get_option( 'gmt_offset' ) );
wp_schedule_event( strtotime( '00:00 tomorrow ' . $ve . $abs_offset . ' HOURS' ), 'daily', 'woocommerce_scheduled_sales' );
$held_duration = get_option( 'woocommerce_hold_stock_minutes', '60' );