Automattic\WooCommerce\Admin\API\Reports\Orders\Stats

DataStore::sync_order()public staticWC 1.0

Add order information to the lookup table when orders are created or modified.

Метод класса: DataStore{}

Хуков нет.

Возвращает

int|true|false. Returns -1 if order won't be processed, or a boolean indicating processing success.

Использование

$result = DataStore::sync_order( $post_id );
$post_id(int) (обязательный)
Post ID.

Код DataStore::sync_order() WC 8.7.0

public static function sync_order( $post_id ) {
	if ( ! OrderUtil::is_order( $post_id, array( 'shop_order', 'shop_order_refund' ) ) ) {
		return -1;
	}

	$order = wc_get_order( $post_id );
	if ( ! $order ) {
		return -1;
	}

	return self::update( $order );
}