Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

GraphQl-622: No possibility to update customizable_options in updateCartItems mutation #626

Merged
merged 12 commits into from
Jun 25, 2019

Conversation

rogyar
Copy link
Contributor

@rogyar rogyar commented Apr 24, 2019

Description (*)

This PR introduces a possibility to update customisable options for cart items using updateCartItems mutation.

Fixed Issues (if relevant)

  1. No possibility to update customizable_options in updateCartItems mutation #622: Add possibility to update customizable_options in updateCartItems mutation

Manual testing scenarios (*)

  1. Create empty cart
  2. Add a product to the shopping cart with customizable options
  3. Use updateCartItems mutation to update the customizable options in the following way
mutation {
  updateCartItems(input: {
    cart_id:"$maskedCartId"
    cart_items: [
      {
        cart_item_id:23
        quantity:-1
        customizable_options: [
          {
            id:1
            value:"test"
          }
        ]
      }
    ]
  }) {
    cart {
      items {
        qty
        product {
          name
        }
        ... on SimpleCartItem {
          customizable_options {
            label
            values {
              label
              value
            }
          }
        }
      }
    }
  }
}

# Conflicts:
#	app/code/Magento/QuoteGraphQl/Model/Resolver/UpdateCartItems.php
@naydav naydav removed the in-progress label May 2, 2019
@naydav naydav changed the title Update cart items with customizable options GraphQl-622: No possibility to update customizable_options in updateCartItems mutation May 2, 2019
Copy link
Contributor

@naydav naydav left a comment

Choose a reason for hiding this comment

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

@rogyar, please, align code to last changes in mainline
thanks
Also, need to cover functionality with API-functional tests

If you would like you can create a separate ticket for this

@rogyar
Copy link
Contributor Author

rogyar commented May 3, 2019

I'm currently working on the tests. Thank you

*/
private function validateCartItem(Item $cartItem): void
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please note that all the validations and error handling are moved here https://github.com/magento/graphql-ce/pull/626/files#diff-23947b0596c6c269244b8667cb99db1aR46

@rogyar
Copy link
Contributor Author

rogyar commented May 8, 2019

Api-functional tests for this feature are done. I will fix other api-functional tests soon.

@naydav
Copy link
Contributor

naydav commented May 8, 2019

Merged last mainline

@TomashKhamlai
Copy link
Contributor

@rogyar could you please share your knowledge? What does it mean @group recent?

@TomashKhamlai
Copy link
Contributor

Tried to update Virtual Product with multiple customizable option and something always goes wrong for me.
The response is:

{
  "errors": [
    {
      "message": "Could not update cart item: The product's required option(s) weren't entered. Make sure the options are entered and try again.",
      "category": "graphql-input",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "updateCartItems"
      ]
    }
  ],
  "data": {
    "updateCartItems": null
  }
}

Fixture Magento/GraphQl/Catalog/_files/set_custom_options_simple_product.php covers area and field customizable options.

It looks like multiple and checkbox are not covered.

@TomashKhamlai
Copy link
Contributor

I found that after every update request that succeeded the cart_item_id is incremented. Please check that it is expected result of successful operation.

@rogyar
Copy link
Contributor Author

rogyar commented May 11, 2019

Hi @TomashKhamlai. As for incremented cart_item_id - it's expected behavior as I described in the description. The same happens when you edit an item from the storefront. If an item's options were changed, the quote item is being recreated with a new set of options and a new cart_item_id.
As for the multiselect options, I will check it out, thank you.

@TomashKhamlai TomashKhamlai added Progress: ready for qa Add this in any case when you need some feedback, even if automated tests are failing and removed QA in progress We are checking labels May 13, 2019
@rogyar
Copy link
Contributor Author

rogyar commented May 19, 2019

Hi @TomashKhamlai. I've just added support for multi-select custom options as well

@TomashKhamlai TomashKhamlai removed the Progress: ready for qa Add this in any case when you need some feedback, even if automated tests are failing label May 20, 2019
@TomashKhamlai TomashKhamlai self-assigned this May 20, 2019
@naydav naydav added Progress: accept and removed QA in progress We are checking labels Jun 24, 2019
@magento-engcom-team
Copy link
Contributor

Hi @naydav, thank you for the review.
ENGCOM-5349 has been created to process this Pull Request
✳️ @naydav, could you please add one of the following labels to the Pull Request?

Label Description
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests
Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests

@ghost
Copy link

ghost commented Jun 25, 2019

Hi @rogyar, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants