Skip to content

Change the calculation date for orders

Nicolas edited this page Oct 22, 2018 · 2 revisions

For example, if you have Proforma commands. The expiry time of the legal order is 3 days.

The plugin in its configuration could cancel orders during the weekend. Here is a filter to modify this:

function woa_date_order_hook( $old_date, $gateway, $mode ) {
	// For example, change date only for cheque.
	if ( 'cheque' == $gateway ) {
		$old_date = strtotime( 'today -3 weekdays' );
	}

	return $old_date;
}
add_filter( 'woo_cao_date_order', 'woa_date_order_hook', 10, 3 );
Clone this wiki locally