cancel
Showing results for 
Search instead for 
Did you mean: 

How to get CartSession, Iterate the list of carts in session and add new custom attributes for one of them?

0 Kudos

Hi,

I need your help to show how could I iterate a list of cart in session, and add new attribute values for one of them,

I need to extend the cartentry to have new atrributes, and save new attributes in model.

Thank you!

Accepted Solutions (0)

Answers (1)

Answers (1)

rohit31_raj92
Active Participant
0 Kudos

Hi

You need to add new attributes in AddToCartParams & CommerceCartParameter , and get the values into CommerceCartParameter by override the cart facade once values are passed from controller to facade in and saved to AddToCartParams and pass the parameters to service where you can pass the parameter values to cart strategy (CommerceAddToCartStrategy) and save value in the strategy class(in cart entry model or cart model) .

You can reference if qty attribute which is passed from Controller to Strategy(service) and value is saved in cart models.

AddToCartController-->DefaultCartFacade---> CommerceCartService-->CommerceAddToCartStrategy

Thanks

rohit31_raj92
Active Participant
0 Kudos

I am assuming you only need to know how you can add any new custom attribute in cart entry,