I have a custom option for a product. I would like to retrieve that data after add to cart is pressed but before the product is actually added to the cart. enter image description here

I want the data '12345'.

I used the checkout_cart_add event observer but I can't get the product as a variable in the observer.php file because the product hasn't been added to the cart yet.

Custom option added from admin backend. enter image description here

What event should I use? and what function to use to get this custom option data?

Any help would be appreciated.

1 Answer 1


During addToCart request, you can get the data you want this way


This should return something like

    [uenc] => ...
    [product] => ...
    [form_key] => ...
    [related_product] => 
    [options] => Array
            [XXXX] => YYYY

Where YYYY inside "options" in this example should be the value you want (12345 in your example), XXXX should be the custom option id

This should work in your observer, as Mage::app()->getRequest() can be accessed there, or maybe you'd want to use some generic controller_action event... not sure why you need to do your thing before product is added to cart, so it's your choice

  • Nice. Glad it helped Commented May 11, 2017 at 17:02

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.