diff --git a/includes/mutation/class-order-create.php b/includes/mutation/class-order-create.php index e82b3caaf..07d9585bf 100644 --- a/includes/mutation/class-order-create.php +++ b/includes/mutation/class-order-create.php @@ -108,6 +108,10 @@ public static function get_input_fields() { 'type' => 'Boolean', 'description' => __( 'Define if the order is paid. It will set the status to processing and reduce stock items.', 'wp-graphql-woocommerce' ), ), + 'createdVia' => array( + 'type' => 'String', + 'description' => __( 'Order created via', 'wp-graphql-woocommerce' ), + ), ); return $input_fields; @@ -169,7 +173,7 @@ public static function mutate_and_get_payload() { throw new UserError( __( 'Customer ID is invalid.', 'wp-graphql-woocommerce' ) ); } - $order->set_created_via( 'graphql-api' ); + $order->set_created_via( ! empty( $input['createdVia'] ) ? $input['createdVia'] : 'graphql-api' ); $order->set_prices_include_tax( 'yes' === get_option( 'woocommerce_prices_include_tax' ) ); $order->calculate_totals( true );