I have created a custom customer attribute in Magento ver.

Now during checkout I want to update it's value depending on type of product added in checkout.

Please anybody guide me about, how can I achieve this.

This is only for already registered customers(also logged in at that time) or users who choose to create account during checkout, not for guests ofcourse.


You will first need to loop through the cart products to check for the existence of the product that is required for the attribute.

Depending on where you want to place the attribute you need to be looking at the template files in YOURTHEME/default/template/checkout/onepage.phtml and YOURTHEME/default/template/checkout/onepage

$cart = Mage::getModel('checkout/cart')->getQuote();
   foreach ($cart->getAllItems() as $item) {
   $productSku = $item->getProduct()->getSku();
   if ($productSku === $myProduct)

if ($showAttribute)
 // render custom attribute

If the product is present you can show/set the attribute value.

You might find these answers useful

Adding custom attribute to Customer


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.