1

I have created a virtual product, and programmatically wants to add custom options in cart item without adding option in product custom option tab becasue it will be different in different cases.

For this I have used below code :

    ...
    $additionalOptions = array(
                         array(
                             'code' => 'title',
                             'label' => 'Title',
                             'value' => $title,
                             'print_value' => $title,
                         ),
                         array(
                             'code' => 'group',
                             'label' => 'Group',
                             'value' => $Value,
                             'print_value' => $Value, 

                        )
                    );

    $item->addOption(array(
                        'code' => 'additional_options',
                        'value' => serialize($additionalOptions),
                    ));
    $item->save();
    ...

But it is not working.

How to add custom options for cart items not for product?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.