Skip to content

Conversation

oskarmodig
Copy link
Contributor

What does this implement/fix? Explain your changes.

Currently $order is set as null at the beginning (line 133), and is never updated. Then it is used in the catch block to attempt a order removal. From my understanding this will never succeed, since $order is always null.

This gets the order object for use in the catch block, and in the graphql_woocommerce_before_checkout action.

So $order also referenced in the doc for action graphql_woocommerce_before_checkout, but the ID is passed. I'm not sure if it's best to update the description to $order_id, or change what is passed like I've done here?

throw new UserError( $order_id->get_error_message( 'checkout-error' ) );
}

$order = \WC_Order_Factory::get_order( $order_id );

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using static access to class '\WC_Order_Factory' in method 'mutate_and_get_payload'.

@qlty-cloud-legacy
Copy link

Code Climate has analyzed commit b417b92 and detected 2 issues on this pull request.

Here's the issue category breakdown:

Category Count
Style 1
Clarity 1

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 75.0% (0.0% change).

View more on Code Climate.

@kidunot89 kidunot89 merged commit a044edf into wp-graphql:develop Feb 15, 2022
@kidunot89 kidunot89 added the bugfix Implements bugfix label Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Implements bugfix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants