cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

OCC v2 - Coupon not moved from anonymous cart to registered user cart

former_member192125
Participant
0 Likes
796

Hi All, we are currently using hybris 6.4 with OCC v2. We are calling the following API to transfer the anonymous cart (with coupon applied) to the registered user:

POST /v2/mysite/users/user@mail.com/carts

Param: oldCartId=c1185754-52b5-4057-9b02-abd24d0db576

The cart entries and promotions get moved to the registered user cart but this is not happening for the coupons.

Any suggestion?

Thanks, Riccardo

Accepted Solutions (0)

Answers (4)

Answers (4)

Eddy_
Explorer
0 Likes

Hi Riccardo,

we had the same issue and solved it by overriding the CartsController/DefaultCartFacade to use this method:

de.hybris.platform.commercefacades.order.impl.DefaultCartFacade.restoreAnonymousCartAndTakeOwnership(String)

It does not clone the given cart, but (really) takes the ownership as the method signature says 😉

Kind regards
Eddy

0 Likes

Hello, I have the hybris version 6.3 and the restoreAnonymousCartAndMerge method gives me the same problem, how could you solve your problem?

former_member192125
Participant
0 Likes

Hi Arvind, we used those APIs for the anonymous cnd they work fine. However they shouldn't be called again when merging the anonymous cart to the user cart. Please see the suggested flow (section Voucher Usage) When the anonymous cart is merged to the user clso coupons should be moved across or not?

I'm afraid I will need to override the current facade logic for the API mentioned at the beginning (/carts) in order to copy over the coupons.

thanks!

arvind-kumar_avinash
Active Contributor
0 Likes

Can you try one of the following after moving the cart?

 POST /{baseSiteId}/users/{userId}/carts/{cartId}/promotions
 POST /{baseSiteId}/users/{userId}/carts/{cartId}/vouchers

Please check https://help.sap.com/doc/0e9065bfffdf4877a5aac1bf4ff9c32c/1811/en-US/ycommercewebservices/index.html for more details.