-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Allow customer to specify associated product qtys when adding grouped product to cart via RESTful API #27845
Allow customer to specify associated product qtys when adding grouped product to cart via RESTful API #27845
Conversation
…ctOptionInterface to allow user to send associated product quantities when adding to cart via REST API Added a 'grouped' cartItemProcessors to the Magento\Quote\Model\Quote\Item\Repository to reformat the super_group extension attribute into a format that is compatible with buy request
Hi @shawnabramson. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
Hi @shawnabramson, thank you for your contribution! |
Is it normal that the "database compare" check run for 4.5hours and its still not finished? |
@bgorski The checks are still running like 10 hours later. Is this typical? |
…the var to be private
…/setter, and method descriptions in GroupedItemQtyInterface, GroupedItemQty, and CartItemProcessor
… and CartItemProcessor
…d-product-restapi
This PR is ready for review, not sure why its failing unit tests |
app/code/Magento/GroupedProduct/Api/Data/GroupedItemQtyInterface.php
Outdated
Show resolved
Hide resolved
app/code/Magento/GroupedProduct/Api/Data/GroupedItemQtyInterface.php
Outdated
Show resolved
Hide resolved
app/code/Magento/GroupedProduct/Model/Quote/Item/GroupedItemQty.php
Outdated
Show resolved
Hide resolved
app/code/Magento/GroupedProduct/Model/Quote/Item/GroupedItemQty.php
Outdated
Show resolved
Hide resolved
app/code/Magento/GroupedProduct/Api/Data/GroupedItemQtyInterface.php
Outdated
Show resolved
Hide resolved
app/code/Magento/GroupedProduct/Api/Data/GroupedItemQtyInterface.php
Outdated
Show resolved
Hide resolved
app/code/Magento/GroupedProduct/Model/Quote/Item/CartItemProcessor.php
Outdated
Show resolved
Hide resolved
Hi @gabrieldagama, thank you for the review. |
✔️ QA Passed Manual testing scenario:
Before: ❌ We got an error: Property "SuperGroup" ... After: ✔️ Grouped product with individual quantities was successfully added to cart Also, checked the situation when the required parameters are not defined. Actual Result: ✔️ The correct message is shown |
…dding grouped product to cart via RESTful API #27845
Hi @shawnabramson, thank you for your contribution! |
Description (*)
This PR addresses the issue described here: magento/magento2#26909
Currently, when adding a grouped product to cart via RESTful API, there is no way to way to specify the quantities for the individual associated products. Additionally, there is no supporting documentation for adding a grouped product to the cart in the docs
Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
These steps assume Magento sample data is installed. Otherwise, update the body of the calls to match your database.
Generate a customer token by sending a post request to the rest/V1/integration/customer/token endpoint with a body of:
{ "username": "roni_cost@example.com", "password": "roni_cost3@example.com" }
Create an empty cart by sending a post request to the rest/V1/carts/mine endpoint. The bearer token should be the token returned by step 1 and the body should be empty.
Add a grouped product to cart by sending a post request to the rest/V1/carts/mine/items endpoint with a body of:
The quote_id parameter in the body should be the quote ID returned by step 2. The bearer token should be the token returned by step 1.
{ "cartItem": { "sku": "gr", "qty": 1, "quote_id": "5", "product_option": { "extension_attributes": { "grouped_options": [ { "id": 2, "qty": 3}, { "id": 3, "qty": 2} ] } } } }
Questions or comments
Contribution checklist (*)