how can I attach a custom text to a product which will be added into the cart along with the product itself when adding it to cart and furthermore being passed through the whole order process like in order page in back office or on pdf invoices and so on??

Ex :

  1. When customer is on my product page he has the opportunity to "customize" the product wih the help of a configuration wizard I have built with javascript/jquery.

  2. List item At the end of this process customer can add customized product to cart which now has a custom price and a custom "ordertext" for me as the shop-owner to get all the customization information

  3. When clicking on add-to-cart-button product is added to cart with new customprice and customtext

Please note that my custom text is not entered by customer. Instead it's gonna be generated by programmatically.

enter image description here


2 Answers 2


You can achieve this by creating an event and observer using your extension and setting the custom price and text through observer.


We have faced same requirements. So use the below mentioned coding.

1) use observer <catalog_product_collection_load_after> in your config.xml file.


2) Crate custom observer file "root/app/code/community/My/Code/Model/Observer/Recurring.php"


class My_Code_Model_Observer_Recurring

    public function getProductValue(Varien_Event_Observer $observer)
        $quote = Mage::getSingleton('checkout/cart')->getQuote();
        foreach ($quote->getAllItems() as $items) {
            $additionalOptions = $items->getOptionByCode("additional_options");
            if (!empty($additionalOptions)) {
                $additionalValue = unserialize($additionalOptions->getValue());
                if (!isset($additionalValue['nn_subscription']) && empty($additionalValue['nn_subscription'])) {
                    $additionalValue['nn_subscription'] = array('label' => 'Custom Text Title', 'value' => 'Custom Text Value');
                    $serializeData = serialize($additionalValue);
            } else {
                $additionalValue['nn_subscription'] = array('label' => 'Custom Text Title', 'value' => 'Custom Text Value');
                  "product_id" => $items->getProduct()->getId(),
                  'code' => "additional_options",
                  'value' => serialize($additionalValue)

Checkout cart Page:

enter image description here Checkout review Page:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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