Repository navigation
Updates to be compatible with WPGraphQL v1.6.1 - #537
Conversation
…ader with a `load_shipping_method_from_id()` function
…solveNode` and replace the resolver with the new connection class `get_connection()` call
Bugfix/wp graphql v1.6x support
…se the value from the `get_enabled_product_types()` as the Type name and the key as the fieldName
WPGraphQL 1.6 support: Update product type query registration
| 'description' => __( 'Total number of items in the cart.', 'wp-graphql-woocommerce' ), | ||
| 'resolve' => function( $source ) { | ||
| if ( empty( $source['edges'] ) ) { | ||
| return 0; |
There was a problem hiding this comment.
Avoid too many return statements within this method.
|
|
||
| $items = array_values( $source['edges'][0]['source']->get_cart() ); | ||
| if ( empty( $items ) ) { | ||
| return 0; |
There was a problem hiding this comment.
Avoid too many return statements within this method.
| return 0; | ||
| } | ||
|
|
||
| return array_sum( array_column( $items, 'quantity' ) ); |
There was a problem hiding this comment.
Avoid too many return statements within this method.
| 'description' => __( 'Total number of different products in the cart', 'wp-graphql-woocommerce' ), | ||
| 'resolve' => function( $source ) { | ||
| if ( empty( $source['edges'] ) ) { | ||
| return 0; |
There was a problem hiding this comment.
Avoid too many return statements within this method.
| return 0; | ||
| } | ||
|
|
||
| return count( array_values( $source['edges'][0]['source']->get_cart() ) ); |
There was a problem hiding this comment.
Avoid too many return statements within this method.
d23b677 to
bea0404
Compare
| 'resolve' => function ( $source, array $args, AppContext $context, ResolveInfo $info ) { | ||
| $resolver = new Cart_Item_Connection_Resolver( $source, $args, $context, $info ); | ||
|
|
||
| return $resolver->get_connection(); |
There was a problem hiding this comment.
Avoid too many return statements within this method.
| } | ||
|
|
||
| return $attributes; | ||
| return $data; |
There was a problem hiding this comment.
Avoid too many return statements within this method.
| 'description' => __( 'Attributes of the variation.', 'wp-graphql-woocommerce' ), | ||
| 'resolve' => function( $source ) { | ||
| $attributes = array(); | ||
| return $attributes; |
There was a problem hiding this comment.
Avoid too many return statements within this method.
| } else { | ||
| $attributes[ $name ] = $default_value; | ||
| } | ||
| return $resolver->one_to_one() |
There was a problem hiding this comment.
Avoid too many return statements within this method.
| } | ||
| } | ||
|
|
||
| return Variation_Attribute_Connection_Resolver::to_data_array( $attributes, $variation->ID ); |
There was a problem hiding this comment.
Avoid too many return statements within this method.
|
Code Climate has analyzed commit bea0404 and detected 117 issues on this pull request. Here's the issue category breakdown:
The test coverage on the diff in this pull request is 87.9% (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. |
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.
What does this implement/fix? Explain your changes.
Does this close any currently open issues?
#536 #535 #533 #528
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?
…
Where has this been tested?