Skip to content

Conversation

florianbepunkt
Copy link
Contributor

@florianbepunkt florianbepunkt commented Oct 14, 2021

Your checklist for this pull request

Thanks for sending a pull request! Please make sure you click the link above to view the contribution guidelines, then fill out the blanks below.

🚨Please review the guidelines for contributing to this repository.

  • 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.
    Nope. Terrible sorry, PHP is not my hometurf. I have no idea

What does this implement/fix? Explain your changes.

The issue: Cart response does always show item and contents total without taxes, regardless of the respective settings in WooCommerce (show prices including tax). This applied to cart item's total as well as cart's contentsTotal

The fix: I copied the relevant parts from Woocommerce Core

Does this close any currently open issues?
Fixes #405

Any relevant logs, error output, GraphiQL screenshots, etc?

(If it’s long, please paste to https://ghostbin.com/ and insert the link here.)

Any other comments?

Kudos to @davevanhoorn and @mraf for their work shown in #405

Where has this been tested?

  • WooGraphQL Version:
  • WPGraphQL Version:
  • WordPress Version:
  • WooCommerce Version:

? $source->get_cart_contents_total()
if ( $source->display_prices_including_tax() ) {
$cart_subtotal = $source->get_subtotal() + $source->get_subtotal_tax();
} else {

Choose a reason for hiding this comment

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

The method register_cart uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.

@qlty-cloud-legacy
Copy link

Code Climate has analyzed commit 88f54ae and detected 4 issues on this pull request.

Here's the issue category breakdown:

Category Count
Style 3
Clarity 1

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

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

View more on Code Climate.

Copy link
Collaborator

@kidunot89 kidunot89 left a comment

Choose a reason for hiding this comment

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

@florianbepunkt It's already covered in CI, but you're failing the linter. Fix that and we should be all good to merge this.

@florianbepunkt
Copy link
Contributor Author

Fixed the whitespace issue.

@kidunot89 kidunot89 merged commit 5a751a2 into wp-graphql:develop Oct 15, 2021
@kidunot89 kidunot89 added the bugfix Implements bugfix label Oct 26, 2021
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.

mutations return cartItem total excluding tax, even if the settings in WP are different
2 participants