Add custom message in checkout cart page after adding product into cart when you are adding product to cart or in checkout page.
Add custom message in checkout cart page after adding product to cart

In this article I am going to explain how you can add custom message in checkout cart page after adding product into cart when you are adding product to cart or in checkout page. First some background. Magento handles item specific display via a product object variable/method called ‘customOptions’. You would already have used this in your code, or come across it, as it is the same place the ‘buyRequest’ data for a product (or cart item) is stored during checkout.

Thus, it is possible for us to inject our own item level message, using the ‘additional_options’ message code. Reading the code, we need to insert an array with keys ‘label’ and ‘value’ How to do it: In this example, I have created a product attribute called ‘custom_message’. This is a varchar field, and can be populated with any message via admin product edit section, or you could add an inputbox in the products area to allow the user to enter a message for the item. The first step is to create an observer for the ‘catalog_product_load_after’ event in your config.xml in the dir :

app/code/local/[NameSpace]/[ModuleName]/etc

and you can place below code here.

[crayon-5e4432dbf2c3d205209929/]

Next create an Observer.php file under model folder in the dir :

app/code/local/[NameSpace]/[ModuleName]/model

and place below code.

[crayon-5e4432dbf2c4a097871305/]
So don’t be selfish please give some comments whether it helps you or not ?

Add custom message in checkout cart page
The following two tabs change content below.
Jyotiranjan is one of passionate programmer who has been working in magento since 6 years and in the mean time he has developed enormous amount of modules and customisation of sites. He loves to write blogs and travel for long journeying.

Latest posts by Jyotiranjan Biswal (see all)

Tagged on:                     

One thought on “Add custom message in checkout cart page

Leave a Reply

Your email address will not be published. Required fields are marked *