When we add to cart than tell me that how to add new key on ['additional'] array on the cart ?



  • i have created some custom product attributes on front end now i need to save product attributes on cart. So first of all i have go to on cart page and i have print all cart items than i got response like this : --

    [attributes:protected] => Array
    (
    [id] => 9
    [quantity] => 2
    [sku] => 5543
    [type] => configurable
    [name] => Gaurav123
    [coupon_code] =>
    [weight] => 40.0000
    [total_weight] => 80.0000
    [base_total_weight] => 80.0000
    [price] => 30.0000
    [base_price] => 30.0000
    [total] => 60.0000
    [base_total] => 60.0000
    [tax_percent] => 0.0000
    [tax_amount] => 0.0000
    [base_tax_amount] => 0.0000
    [discount_percent] => 0.0000
    [discount_amount] => 0.0000
    [base_discount_amount] => 0.0000
    [additional] => {"is_buy_now":"0","_token":"wiJIemaf5rBStxjx5VNGoZJHmhnIX1IQHcP7wo9s","product_id":"29","selected_configurable_option":"32","quantity":"2","super_attribute":{"23":"1"},"custom_size_qty":{"21":"1","22":"1"},"attributes":{"color":{"attribute_name":"Color","option_id":1,"option_label":"Red"},"GauravAttr":{"attribute_name":"Font Sizes","option_id":22,"option_label":"latest name 2"}}}
    [parent_id] =>
    [product_id] => 29
    [cart_id] => 65
    [tax_category_id] =>
    [created_at] => 2020-03-21 16:57:22
    [updated_at] => 2020-03-21 17:17:57
    [custom_price] =>
    [applied_cart_rule_ids] =>
    )

    tell me that how can i add value on addtional key ?
    thanks



  • Hello @_developer_12 ,
    Can you please elaborate this with screenshots.
    Thank you.



  • c1c4290e-ed3c-4495-9d20-d9f0159bd557-image.png you can see in this picture...i have new custome attribute which manage by admin. now i want to add to cart all products attribute.



  • 3a7736f3-489c-4b9c-8211-cc4c5e770883-image.png

    you can see this image that when i have clicked on cart button so that time i got response as picture. i have create new array [custom_size_qty] in cart array as picture. so now i need to get all attributes on cart list. like following screen shot : -

    4afaaa5d-dd1c-490f-b051-1b7fa0c071c8-image.png



  • I didn't get you well, Do you want to see those attribute in the cart.Please check the screenshot.
    click on the below link.
    https://prnt.sc/rmcfyg


Log in to reply