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

\Magento\Quote\Model\QuoteManagement::createEmptyCartForCustomer return not Empty Cart #5913

Closed
ytorbyk opened this issue Jul 31, 2016 · 22 comments
Labels
Api bug report Component: Checkout Component: Webapi Use with concrete module component label E.g. "Component: Webapi" + "Catalog" Event: mm20in Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P3 May be fixed according to the position in the backlog. Progress: done Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. stale issue Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Milestone

Comments

@ytorbyk
Copy link
Member

ytorbyk commented Jul 31, 2016

There is expected to receive an empty Cart (or Quote) due calling "createEmptyCartForCustomer" method. It says the method name. But it's not always true.

Preconditions (*)

Magento 2.4-develop

Steps to reproduce (*)

  1. Call the API method /V1/customers/:customerId/carts
    <route url="/V1/customers/:customerId/carts" method="POST"> <service class="Magento\Quote\Api\CartManagementInterface" method="createEmptyCartForCustomer"/> <resources> <resource ref="Magento_Cart::manage" /> </resources> </route>
  2. Notice response (in my case 2)
    image
  3. Send request again
  4. Check response

Expected result (*)

  1. The really new empty cart (quote) will be created and returned. All further changes applied to the cart will not impact the customer on the front-end.

Actual result (*)

  1. The method returns current active quote. If you change the cart it will change cart of the logged in customer.
    image
@SerhiyShkolyarenko
Copy link
Contributor

Sorry Yuriy, that expected result is wrong in case of Magento. Our user has only one active cart, if admin resets that cart from API, user will see empty cart on frontend.

@SerhiyShkolyarenko
Copy link
Contributor

To create order not impacting current user's cart you may utilize Sales module service:
<route url="/V1/orders/create" method="PUT"> <service class="Magento\Sales\Api\OrderRepositoryInterface" method="save"/> <resources> <resource ref="Magento_Sales::sales" /> </resources> </route>
It requires huge amount of data, but creates order in one step.

@SerhiyShkolyarenko SerhiyShkolyarenko added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Sep 8, 2016
@SerhiyShkolyarenko
Copy link
Contributor

SerhiyShkolyarenko commented Sep 8, 2016

Created internal issue MAGETWO-58190 for updating annotation for createEmptyCartForCustomer() and creating new service supporting old behavior: create new cart for customer and leave it inactive.
Thank you for the report.

@duffner
Copy link

duffner commented Sep 8, 2016

@SerhiyShkolyarenko , I believe Yurii to be correct. The intent of this method is to return a quote from the "quote" table with the column "is_active" boolean set to "0". Preparing a quote object for conversion to a transaction via API or other external methods should be able to bypass the current active session. This is a feature of Magento 1, and all Magento 1 features were to be included with Magento 2 this is not an annotation issue, this is missing / not completed functionality. @benmarks, I'd like to involve you in this issue / broken / missing feature. This is a major issue for any customers who want to be able to create an order for a customer, without deleting their existing cart, I'm hoping you can see that this major Enterprise feature is not lost in Magento 2.

@duffner
Copy link

duffner commented Sep 8, 2016

@SerhiyShkolyarenko, I am aware of the <route url="/V1/orders/create" method="PUT"> <service class="Magento\Sales\Api\OrderRepositoryInterface" method="save"/> <resources> <resource ref="Magento_Sales::sales" /> </resources> </route> However, creating an order directly doesn't always make sense as you may need to manipulate the object prior to an order.

@SerhiyShkolyarenko
Copy link
Contributor

@duffner thank you for explanation. In Magento 1 that was undocumented feature and in services we lost it. Now we promoted priority of MAGETWO-58190 in order to restore that lost feature and fix our docs.

@duffner
Copy link

duffner commented Oct 17, 2016

@SerhiyShkolyarenko thank you!!

@magento-engcom-team magento-engcom-team added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report Component: Checkout Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed labels Sep 11, 2017
@magento-engcom-team magento-engcom-team added the Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed label Oct 20, 2017
@magento-engcom-team
Copy link
Contributor

@ytorbyk, thank you for your report.
We've created internal ticket(s) MAGETWO-58190 to track progress on the issue.

@magento-engcom-team magento-engcom-team added 2.1.x Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Oct 20, 2017
@ghost ghost removed Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development labels Oct 20, 2020
@gabrieldagama gabrieldagama added Priority: P3 May be fixed according to the position in the backlog. Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. labels Oct 27, 2020
@gabrieldagama gabrieldagama added this to the 2.5 milestone Oct 27, 2020
@gabrieldagama gabrieldagama added Component: Api Use with concrete module component label E.g. "Component: Api" + "Catalog" Api and removed Component: Api Use with concrete module component label E.g. "Component: Api" + "Catalog" labels Oct 27, 2020
@stale
Copy link

stale bot commented Jan 11, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale issue label Jan 11, 2021
@duffner
Copy link

duffner commented Jan 11, 2021

Team,
This is still a valid issue. While I understand it's stale, it's still wrong :)

@stale stale bot removed the stale issue label Jan 11, 2021
@stale
Copy link

stale bot commented Mar 29, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!

@stale stale bot added the stale issue label Mar 29, 2021
@ytorbyk
Copy link
Member Author

ytorbyk commented Apr 8, 2021

What activity is required here? Please, work on it.

@stale stale bot removed the stale issue label Apr 8, 2021
@stale
Copy link

stale bot commented Jun 23, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!

@duffner
Copy link

duffner commented Apr 20, 2023

Just because I'm thinking about a 7-year-old issue, maybe I should see if it can get some love :). This is still a valid issue "createEmptyCartForCustomer" does not return an empty cart, nor does it always create.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Api bug report Component: Checkout Component: Webapi Use with concrete module component label E.g. "Component: Webapi" + "Catalog" Event: mm20in Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P3 May be fixed according to the position in the backlog. Progress: done Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. stale issue Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
None yet
Development

No branches or pull requests