I have a cookie like this: enter image description here

How can i get value and name of this in phtml file?

Any help? Thank in advance.


You cannot get cookie in a Block and hence cannot use it in phtml file as a PHP variable.

If you want to use the cookies in Javascript you can use the following

  require(["jquery"], function($){
    var cookie = $.cookie("example");

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.