Skip to content

Conversation

@creative-andrew
Copy link
Contributor

@creative-andrew creative-andrew commented Mar 13, 2023

  • Make sure you are making a pull request against the develop branch (left side). Also you should start your branch off our develop.
  • Make sure you are requesting to pull request from a topic/feature/bugfix/devops branch (right side). Don't pull request from your master!
  • Have you ensured/updated that CLI tests to extend coverage to any new logic. Learn how to modify the tests here.

What does this implement/fix? Explain your changes.

In this commit , the arguments passed into the function \wc_get_price_to_display are incorrect.

The function receives as a parameter the $product and an array $args.

We are currently including the $product inside the $args array.

https://woocommerce.github.io/code-reference/namespaces/default.html#function_wc_get_price_to_display

Additionally, this PR removes \wc_get_price_to_display from the priceRaw to be consistent with the other raw prices.

Raw price should not be passed into functions such as \wc_get_price_to_display or \wc_graphql_price

@creative-andrew creative-andrew changed the title Fix wrong arg in sale place wc_get_price_to_display and remove wc_get_price_to_display from raw price. Fix wrong function args in sale price and remove wc_get_price_to_display from raw price. Mar 13, 2023
},
'priceRaw' => function() {
return ! empty( $this->wc_data->get_price() ) ? \wc_get_price_to_display( $this->wc_data ) : null;
return ! empty( $this->wc_data->get_price() ) ? $this->wc_data->get_price() : null;

Choose a reason for hiding this comment

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

Avoid too many return statements within this method.

@qlty-cloud-legacy
Copy link

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

Here's the issue category breakdown:

Category Count
Complexity 2

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

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

View more on Code Climate.

@kidunot89 kidunot89 self-requested a review March 17, 2023 18:51
@kidunot89 kidunot89 merged commit 7343ab2 into wp-graphql:develop Mar 17, 2023
@kidunot89 kidunot89 added the bugfix Implements bugfix label Apr 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Implements bugfix

2 participants