Merge pull request #26567 from woocommerce/fix/26510-created-date

Allow set "date_created" while creating orders via CRUD
This commit is contained in:
Claudio Sanches 2020-07-01 12:40:43 -03:00 committed by GitHub
commit cac529c393
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -57,8 +57,10 @@ abstract class Abstract_WC_Order_Data_Store_CPT extends WC_Data_Store_WP impleme
*/
public function create( &$order ) {
$order->set_version( Constants::get_constant( 'WC_VERSION' ) );
$order->set_date_created( time() );
$order->set_currency( $order->get_currency() ? $order->get_currency() : get_woocommerce_currency() );
if ( ! $order->get_date_created( 'edit' ) ) {
$order->set_date_created( time() );
}
$id = wp_insert_post(
apply_filters(