i want product id from local storage in observer is there any easy way to do it?

enter image description here


You can use below code in your controller

echo 'product id'.$product_id;
  • it work fine but maybe its not proper method – Hiren Aug 16 '18 at 9:25
  • yes its not good way to add like that in controller you can use ajax from phtml to get value in controller. by the way can you up vote my answer ? – Ansar Husain Aug 16 '18 at 9:27

local storage it a client-side element and controller is a server-side element. So you have read this variable using js and send to via an ajax request.


Can able to provide local storage data

  • can you provide me any reference for that ?? – Hiren Aug 17 '18 at 10:27
  • no, Just have an idea. – Amit Bera Aug 17 '18 at 10:42
  • how can i add custom tab in local storage not in under "mage-cache-storage" ? – Hiren Aug 21 '18 at 5:45

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.