How to Use Session or Cookie in Magento 2.0How to add Cookie Magento 2?Magento 2 session id cookie - where to find it?Magento Cookie Value Not SetSet a COOKIE in Observer and use it in JavascriptCookie-/ Session Problem after SSL Proxy ConfigurationAdmin login problems. What are the correct settings of Session Cookie Management and Session Validation Management?Session and cookies are not removing in MagentoHow to Set Session Cookie Based on Query-String Param in MagentoSession cookie timeout limitHow can I get Magento Each Session values by using Magento frontend cookie value through Web Service?Magento 2 session id cookie - where to find it?Magento 2: After custom cookie is created all pages default to home page

How can I add custom success page

What are the advantages and disadvantages of running one shots compared to campaigns?

Is "plugging out" electronic devices an American expression?

Patience, young "Padovan"

Are white and non-white police officers equally likely to kill black suspects?

Is every set a filtered colimit of finite sets?

A poker game description that does not feel gimmicky

extract characters between two commas?

Why doesn't a const reference extend the life of a temporary object passed via a function?

What happens when a metallic dragon and a chromatic dragon mate?

Is it legal to have the "// (c) 2019 John Smith" header in all files when there are hundreds of contributors?

Was there ever an axiom rendered a theorem?

Why did the Germans forbid the possession of pet pigeons in Rostov-on-Don in 1941?

Can I legally use front facing blue light in the UK?

Extreme, but not acceptable situation and I can't start the work tomorrow morning

What does "enim et" mean?

Why is my log file so massive? 22gb. I am running log backups

How to make payment on the internet without leaving a money trail?

Calculate Levenshtein distance between two strings in Python

Email Account under attack (really) - anything I can do?

Can I find out the caloric content of bread by dehydrating it?

Symmetry in quantum mechanics

Manga about a female worker who got dragged into another world together with this high school girl and she was just told she's not needed anymore

COUNT(*) or MAX(id) - which is faster?



How to Use Session or Cookie in Magento 2.0


How to add Cookie Magento 2?Magento 2 session id cookie - where to find it?Magento Cookie Value Not SetSet a COOKIE in Observer and use it in JavascriptCookie-/ Session Problem after SSL Proxy ConfigurationAdmin login problems. What are the correct settings of Session Cookie Management and Session Validation Management?Session and cookies are not removing in MagentoHow to Set Session Cookie Based on Query-String Param in MagentoSession cookie timeout limitHow can I get Magento Each Session values by using Magento frontend cookie value through Web Service?Magento 2 session id cookie - where to find it?Magento 2: After custom cookie is created all pages default to home page






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I am going to add Age verification block on Home page. for that i want to set session or cookie variable. so that i can check it through out all pages of store weather age verification session or cookie set or not.










share|improve this question
















bumped to the homepage by Community 10 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • The block only show on Homepage?

    – Khoa TruongDinh
    Sep 8 '16 at 14:38











  • You can take a look at this answer: magento.stackexchange.com/questions/100136/…

    – Ledian Hymetllari
    Aug 28 '17 at 0:06

















1















I am going to add Age verification block on Home page. for that i want to set session or cookie variable. so that i can check it through out all pages of store weather age verification session or cookie set or not.










share|improve this question
















bumped to the homepage by Community 10 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • The block only show on Homepage?

    – Khoa TruongDinh
    Sep 8 '16 at 14:38











  • You can take a look at this answer: magento.stackexchange.com/questions/100136/…

    – Ledian Hymetllari
    Aug 28 '17 at 0:06













1












1








1








I am going to add Age verification block on Home page. for that i want to set session or cookie variable. so that i can check it through out all pages of store weather age verification session or cookie set or not.










share|improve this question
















I am going to add Age verification block on Home page. for that i want to set session or cookie variable. so that i can check it through out all pages of store weather age verification session or cookie set or not.







magento2 cookie customer-session






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 8 '16 at 12:37









Qaisar Satti

27.1k1256109




27.1k1256109










asked Sep 8 '16 at 12:36









BhaveshBhavesh

316




316





bumped to the homepage by Community 10 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 10 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.














  • The block only show on Homepage?

    – Khoa TruongDinh
    Sep 8 '16 at 14:38











  • You can take a look at this answer: magento.stackexchange.com/questions/100136/…

    – Ledian Hymetllari
    Aug 28 '17 at 0:06

















  • The block only show on Homepage?

    – Khoa TruongDinh
    Sep 8 '16 at 14:38











  • You can take a look at this answer: magento.stackexchange.com/questions/100136/…

    – Ledian Hymetllari
    Aug 28 '17 at 0:06
















The block only show on Homepage?

– Khoa TruongDinh
Sep 8 '16 at 14:38





The block only show on Homepage?

– Khoa TruongDinh
Sep 8 '16 at 14:38













You can take a look at this answer: magento.stackexchange.com/questions/100136/…

– Ledian Hymetllari
Aug 28 '17 at 0:06





You can take a look at this answer: magento.stackexchange.com/questions/100136/…

– Ledian Hymetllari
Aug 28 '17 at 0:06










1 Answer
1






active

oldest

votes


















0














You can use the below classess to set cookie and session in your block by passing into dependency.




MagentoFrameworkSessionSessionManagerInterface;



MagentoFrameworkStdlibCookieCookieMetadataFactory;



MagentoFrameworkStdlibCookiePublicCookieMetadata;



MagentoFrameworkStdlibCookieManagerInterface;




For reference link



Hope it helps.






share|improve this answer

























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "479"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f135370%2fhow-to-use-session-or-cookie-in-magento-2-0%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    You can use the below classess to set cookie and session in your block by passing into dependency.




    MagentoFrameworkSessionSessionManagerInterface;



    MagentoFrameworkStdlibCookieCookieMetadataFactory;



    MagentoFrameworkStdlibCookiePublicCookieMetadata;



    MagentoFrameworkStdlibCookieManagerInterface;




    For reference link



    Hope it helps.






    share|improve this answer





























      0














      You can use the below classess to set cookie and session in your block by passing into dependency.




      MagentoFrameworkSessionSessionManagerInterface;



      MagentoFrameworkStdlibCookieCookieMetadataFactory;



      MagentoFrameworkStdlibCookiePublicCookieMetadata;



      MagentoFrameworkStdlibCookieManagerInterface;




      For reference link



      Hope it helps.






      share|improve this answer



























        0












        0








        0







        You can use the below classess to set cookie and session in your block by passing into dependency.




        MagentoFrameworkSessionSessionManagerInterface;



        MagentoFrameworkStdlibCookieCookieMetadataFactory;



        MagentoFrameworkStdlibCookiePublicCookieMetadata;



        MagentoFrameworkStdlibCookieManagerInterface;




        For reference link



        Hope it helps.






        share|improve this answer















        You can use the below classess to set cookie and session in your block by passing into dependency.




        MagentoFrameworkSessionSessionManagerInterface;



        MagentoFrameworkStdlibCookieCookieMetadataFactory;



        MagentoFrameworkStdlibCookiePublicCookieMetadata;



        MagentoFrameworkStdlibCookieManagerInterface;




        For reference link



        Hope it helps.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Apr 13 '17 at 12:54









        Community

        1




        1










        answered Sep 8 '16 at 12:41









        Krishna ijjadaKrishna ijjada

        5,86542356




        5,86542356



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f135370%2fhow-to-use-session-or-cookie-in-magento-2-0%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Jet Time Laivasto | Lähteet | Aiheesta muualla | NavigointivalikkoJet Time - The CompanyThe CompanyManagementJet Time aloittaa lauantaina Suomi-rekisterissä olevalla Boeing 737 -koneellaJettime Finland Fleet Details and HistoryJettime Fleet Details and HistoryRegional Jet OÜ takes over ATR production for SASJet Time Returns To Its Core BusinessYhtiön kotisivutlaajentamalla

            Olympian arkeologinen museo Sisällysluettelo Historia ja rakennus | Kokoelmat | Lähteet | Aiheesta muualla | Navigointivalikko37°38′36″N, 21°37′46″EInfobox OKArchaeological Museum of Olympia: HistoryArchaeological Museum of Olympia: DescriptionΜουσείο Ιστορίας των Ολυμπιακών Αγώνων της Αρχαιότητας: ΙστορικόArchaeological Museum of Olympia

            Äpy Sisällysluettelo Äpyt kautta historian | Esimerkkejä Äpy-huumorista | Katso myös | Kirjallisuutta | Aiheesta muualla | Navigointivalikkowww.äpy.fi