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

Cart calculate without Customer after login #6629

Open
runelaenen opened this issue Feb 6, 2025 · 5 comments
Open

Cart calculate without Customer after login #6629

runelaenen opened this issue Feb 6, 2025 · 5 comments
Labels
Platform(Default) Status:Open This issue is ready for implementation.

Comments

@runelaenen
Copy link
Contributor

runelaenen commented Feb 6, 2025

PHP Version: 8.3 | Shopware Version: 6.6.9.0 | Affected area / extension: Platform(Default)


Actual behaviour:

After logging in, the cart is calculated the first time without the Customer entity present in the SalesChannelContext. When loading customer-specific data this can adapt the cart with default data.

In our case, we have customer-specific Minimum Order Quantities. When a customer logs in who can order "per 1 piece" instead of following the general MOQ of the product, the cart is filled with the MOQ when they log in. After that they can again use their cart as normal, ordering just the single quantities. However on logging in, their cart is calculated once without the Customer entity present in the SalesChannelContext, when the quantities are changed to the product MOQ.

Expected behaviour:

After login, the Customer entity is present in the SalesChannelContext when the cart is calculated.

How to reproduce:

Has to be reproduced in a project with customer-specific data customization. On product load, the 'minPurchase' field is set to 1 for certain customers.
Log in as this customer and add products to cart in any qty lower than the minPurchase for that product.
Log out
Log in again. The cart will have been set to MOQ for all products.

@shopwareBot
Copy link

[public] Shopware automated response: This issue is linked to the internal issue: NEXT-40587

[created from NEXT-40587, comment 538153]

@mstegmeyer
Copy link
Contributor

Just for clarity: I'm not exactly sure about the timing of your bug ticket. Are you talking about one cart calculation being done without the customer, when the LoginRoute is being called? This is wanted behavior, because we merge the guest cart and the customer cart together and do another calculation afterwards.

If this is not what you are talking about and you are not talking about calculations during the LoginRoute, please tell me, what route you are talking about and how to reproduce it by probably providing a basic example.

@runelaenen
Copy link
Contributor Author

Hi Max,

It does indeed happen on the LoginRoute. However there is, in our case, no cart before login. (Or well, it is always empty). So even after merging, the cart is calculated once without the customer in the context. I understand that the original cart should be calculated without the customer, but should it not always contain the customer after the merge?

@mstegmeyer
Copy link
Contributor

It should, yes. We will try to reproduce this on a fresh system. I assume, this behavior happens inside a cart processor or collector? Do you use the Twig Storefront or are we talking about composable frontend / direct API access?

@shopwareBot shopwareBot added the Status:Open This issue is ready for implementation. label Feb 10, 2025
@shopwareBot
Copy link

[public]

Priority changed to: High

Thank you for your report. Based on the information in this report, we have decided to investigate this issue in more detail and are planning to provide a fix for this issue. Although we are always eager to solve such problems as soon as we can, we can't give you a more specific time frame right now. We appreciate your patience and thank you for your understanding.

[created from NEXT-40587, comment 538550]

@BrocksiNet BrocksiNet removed the Bug label Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform(Default) Status:Open This issue is ready for implementation.
Projects
None yet
Development

No branches or pull requests

4 participants