wp-graphql-woocommerce icon indicating copy to clipboard operation
wp-graphql-woocommerce copied to clipboard

(Query) Format currency in cart type

Open victormattosvm opened this issue 2 years ago • 3 comments

What does this implement/fix? Explain your changes.

Following the default behavior, I added the option to format currency in the cart fields. I had to change return type from null to 0 in some fields, just trying to follow the default behavior.

Does this close any currently open issues?

Not that I know

victormattosvm avatar Mar 31 '22 19:03 victormattosvm

@kidunot89 the format argument is optional. By default, the price is being returned already formatted as it was before. So how do you advise me to add the RAW format in the first test? I haven't found a similar test of this argument to rely on.

victormattosvm avatar Apr 21 '22 20:04 victormattosvm

@kidunot89 You can use aliases to use the same field twice in a query like this.

query {
	cart {
		subtotal
		rawSubtotal: subtotal(format: RAW)
	}
}

kidunot89 avatar May 17 '22 17:05 kidunot89

Code Climate has analyzed commit 4cd583d5 and detected 265 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 17
Duplication 13
Style 235

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

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

View more on Code Climate.

codeclimate[bot] avatar Aug 29 '22 17:08 codeclimate[bot]