I have been trying to create add to cart options programmatically. It's working well when i add a simple value but i cannot add any file type like any image.

I used this code to add it with order cart item.

$additionalOptions = array(array(
            'code' => 'lmc_custom_thread',
            'label' => 'Thread Color',
            'value' => "radhagobindwa Das",
            'print_value' => "radhagobindwa Das",
            'option_id' => "test",
            'option_type' => "file",
            'custom_view' => '',
            'image_path' =>  '/media/'."j2t_image_small.png",

            'code' => 'additional_options',
            'value' => serialize($additionalOptions)

It's shows only value ["radhagobindwa Das"] and I want to show this image path.

1 Answer 1


I assume you want to get this value to display in cart , review sections.

You can able to retrieve the additional_options from cart renderer file using

$additionalOptions = $_item->getOptionByCode('additional_options'); 
$additional_options = unserialize($additionalOptions->getValue());

//or by using 

 $additional_options = $_item->getProductOptions();

Print it and see your image stored there. From here you can show the uploaded image src.


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.