on 2019 Jan 29 9:37 AM
We are using Hybris Commerce in version 6.5.
In DefaultCommerceAddToCartStrategy from the b2boccaddon the following steps will be performed after adding an entry to the card:
@Override
public CommerceCartModification addToCart(final CommerceCartParameter parameter) throws CommerceCartModificationException
{
final CommerceCartModification modification = doAddToCart(parameter);
getCommerceCartCalculationStrategy().calculateCart(parameter);
afterAddToCart(parameter, modification);
// Here the entry is fully populated, so we can search for a similar one and merge.
mergeEntry(modification, parameter);
return modification;
}
The problem is: if you add the same product which is already in the cart -> the cart will be calculated and after that the positions will be merged with the effect that subtotal of the merged entry is wrong! Imho the code should look like:
public CommerceCartModification addToCart(final CommerceCartParameter parameter) throws CommerceCartModificationException
{
final CommerceCartModification modification = doAddToCart(parameter);
// Here the entry is fully populated, so we can search for a similar one and merge.
mergeEntry(modification, parameter);
getCommerceCartCalculationStrategy().calculateCart(parameter);
afterAddToCart(parameter, modification);
return modification;
}
What do you think?
Request clarification before answering.
| User | Count |
|---|---|
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.