Additional Parameter in Cart

  • Posts: 42
  • Thank you received: 3
9 months 4 weeks ago #353005

-- url of the page with the problem -- : lazykitchen.satumalaysiahosting.com/checkout

Hi,

May I know Is there any way to save the additional parameter in cart but not override?

I would like to append additional parameter on every add to cart.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 81597
  • Thank you received: 13081
  • MODERATOR
9 months 4 weeks ago #353016

Hi,

If you check the save function of class.cart, you can see that the data in $element->additional is moved to $element->cart_params->additional before the event onBeforeCartSave is called. And after the event, the content of $element->cart_params is json_encode

So you can do it in onBeforeCartSave, but you need to add it to $element->cart_params->additional yourself so that it is taken into account.

Please Log in or Create an account to join the conversation.

  • Posts: 42
  • Thank you received: 3
9 months 5 days ago #353815

Hi,

I tried use $element->cart_params->additional = $additional; but the discount not loaded also.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 81597
  • Thank you received: 13081
  • MODERATOR
9 months 5 days ago #353833

Hi,

Ah yes. You need to move the additional from $element->cart_params->additional to $element->additional yourself when the cart is being loaded. For example with the event onAfterCartLoad(&$element, &$options)

Please Log in or Create an account to join the conversation.

Time to create page: 0.061 seconds
Powered by Kunena Forum