Skip to content

Commit

Permalink
chore: OrderIdTypeEnum value "ORDER_NUMBER" renamed to "ORDER_KEY" (#831
Browse files Browse the repository at this point in the history
)
  • Loading branch information
kidunot89 authored Dec 27, 2023
1 parent bb03103 commit ffd1430
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions includes/type/enum/class-id-type-enums.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ public static function register() {
[
'description' => __( 'The Type of Identifier used to fetch a single Order. Default is ID.', 'wp-graphql-woocommerce' ),
'values' => [
'id' => self::get_value( 'id' ),
'database_id' => self::get_value( 'database_id' ),
'order_number' => [
'name' => 'ORDER_NUMBER',
'value' => 'order_number',
'description' => __( 'Order number.', 'wp-graphql-woocommerce' ),
'id' => self::get_value( 'id' ),
'database_id' => self::get_value( 'database_id' ),
'order_key' => [
'name' => 'ORDER_KEY',
'value' => 'order_key',
'description' => __( 'Order key.', 'wp-graphql-woocommerce' ),
],
],
]
Expand Down
2 changes: 1 addition & 1 deletion includes/type/object/class-root-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public static function register_fields() {

$order_id = null;
switch ( $id_type ) {
case 'order_number':
case 'order_key':
$order_id = \wc_get_order_id_by_order_key( $id );
break;
case 'database_id':
Expand Down
4 changes: 2 additions & 2 deletions tests/wpunit/OrderQueriesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,11 @@ public function testOrderQueryAndIds() {
/**
* Assertion Three
*
* Tests "ORDER_NUMBER" ID type
* Tests "ORDER_KEY" ID type
*/
$variables = [
'id' => $this->factory->order->get_order_key( $order_id ),
'idType' => 'ORDER_NUMBER',
'idType' => 'ORDER_KEY',
];
$response = $this->graphql( compact( 'query', 'variables' ) );

Expand Down

0 comments on commit ffd1430

Please sign in to comment.