Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addToCart mutation #56

Merged
merged 1 commit into from
May 3, 2019
Merged

Conversation

kidunot89
Copy link
Member

@kidunot89 kidunot89 commented May 3, 2019

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 branch (right side). Don't pull request from your master!

What does this implement/fix? Explain your changes.

Adds addToCart mutation to schema.

mutation addToCart( $input: AddToCartInput! ) {
    addToCart( input: $input ) {
        clientMutationId
        cartItem {
            key
            product {
                id
            }
            variation {
                id
            }
            quantity
            subtotal
            subtotalTax
            total
            tax
        }
    }
}

AddToCartInput definition.

'clientMutationId' => array(
	'type'        => array( 'non_null' => 'ID' ),
	'description' => __( 'Unique ID for mutation', 'wp-graphql-woocommerce' ),
),
'productId'   => array(
	'type'        => array( 'non_null' => 'Int' ),
	'description' => __( 'Cart item product database ID or global ID', 'wp-graphql-woocommerce' ),
),
'quantity'    => array(
	'type'        => 'Int',
	'description' => __( 'Cart item quantity', 'wp-graphql-woocommerce' ),
),
'variationId' => array(
	'type'        => 'Int',
	'description' => __( 'Cart item product variation database ID or global ID', 'wp-graphql-woocommerce' ),
),
'variation'   => array(
	'type'        => array( 'list_of' => 'ProductAttributeInput' ),
	'description' => __( 'Cart item product variation attributes', 'wp-graphql-woocommerce' ),
),
'extraData'   => array(
	'type'        => 'String',
	'description' => __( 'JSON string representation of extra cart item data', 'wp-graphql-woocommerce' ),
),

Does this close any currently open issues?

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?

Operating System:

WordPress Version:

@kidunot89 kidunot89 added enhancement New feature or request work in progress Solution development in progress new mutations Feature adds mutation(s) to the schema labels May 3, 2019
@kidunot89 kidunot89 added this to the v0.1.x milestone May 3, 2019
@kidunot89 kidunot89 self-assigned this May 3, 2019
@kidunot89 kidunot89 merged commit bd1d365 into release-v0.1.0 May 3, 2019
@kidunot89 kidunot89 removed the work in progress Solution development in progress label May 3, 2019
@renatonascalves renatonascalves deleted the feature/add-item-to-cart-mutation branch May 4, 2019 00:07
This was referenced May 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request new mutations Feature adds mutation(s) to the schema
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant