Questions tagged [customer-session]

Denotes questions regarding Magento customer session.

Filter by
Sorted by
Tagged with
2
votes
0answers
15 views

How to retain customer login after switching website in Magento 2.3?

I have a website switcher button on my Magento 2.3 site (not a store switcher). When a customer logs in on the website - abc.magento.com, I programmatically switch the website to pqr.magento.com, it ...
1
vote
1answer
37 views

How to show Block depending on Customer Logged In/Out in Magento 2

I want to Show Conditionally Depend of customer logged in status For Magento 1 i Found this Solution i want Same Lopic for Magento 2 // is Logged in <customer_logged_in> <reference ...
0
votes
0answers
17 views

Magento 2 All other sessions are automatically closed after a password has been changed by the customer

The customer is logged in on different devices or browsers at the time customer changes his password then all other sessions are automatically closed after a password has been changed but other ...
0
votes
2answers
17 views

Trouble in getting in customer data using block class

I'm having trouble in getting the customer details using block class. I want to show the customer name after he/she logged in using block class. I can do it via object manager but not through block. ...
2
votes
2answers
40 views

Magento 2 : \Magento\Customer\Model\SessionFactory $customerSession is not working with FPC

If we need to get current customer sessions in a block, cacheable must be set to false in the layout XML. I am using \Magento\Customer\Model\SessionFactory $customerSession in my block but it is not ...
0
votes
1answer
48 views

How to get customer session data outside Magento

I want to know if it is possible to get customer session data outside of magento2 <?php error_reporting(E_ALL | E_STRICT); $mageFilename = 'app/Mage.php'; require_once $mageFilename; $app = Mage::...
0
votes
0answers
11 views

Implementation of session based authentication for API in Magento 2

Actually I am trying to create a check over custom customer attribute for example: if($customer->IsPartner() == TRUE){ return $token; } else{ return "Access is allowed to ...
0
votes
1answer
37 views

Magento2: Admin dashboard is suddenly logout some times

when I login to the admin dashboard, after some seconds admin is logged out and redirects to the login page. What is this issue?
0
votes
0answers
13 views

Firefox TypeError: options is undefined in customer-data.js with Weltpixel pearl theme 1.5.5

Getting TypeError: options is undefined in customer-data.js with firefox, With chrome it's working good no issue. Using Magento 2.2.0 & Wetpixel pearl theme1.5.5 This issue is not coming for all ...
0
votes
0answers
18 views

Magento 2.2.9: wrong data when creating Customer Session from Session Factory

I´m trying to get Customer data and insert it into some hidden inputs on a form. It checks if there is a customer logged in, but the data is from another customer, and it doesn't change even if I log ...
3
votes
1answer
57 views

Session lifetime in magento2 frontend?

What is the maximum session life time for the frontend customers in magento2? Also, Is the session lifetime depends on session.gc_maxlifetime php variable? Any help please?
1
vote
1answer
39 views

Magento 2 : How to end all active sessions for a customer?

I was looking for possibility where i can give option to customer after password update to end all active sessions related to his account . It would be helpful if can point in direction (even with a ...
1
vote
0answers
66 views

Magento 2 TypeError: options is undefined in firefox

After working for few day I noticed that I am getting this issue in my Firefox and not in Chrome. TypeError: options is undefined If I do cache clean and check in Firefox it works for the first ...
0
votes
3answers
74 views

getting null in customer email Magento 2 Custmer session

Edit.php (block) class Edit extends \Magento\Framework\View\Element\Template { protected $request; protected $customerSession; public function __construct( \Magento\...
1
vote
2answers
40 views

M2 | How to Get Logged in customer ID in Model class?

I need customer ID in Model class as I am creating custom API. I can get customer ID in Controller as well as in Block class by all below ways: Injecting in constructor \Magento\Customer\Model\...
0
votes
0answers
33 views

Magento 1.9 Frontend-Sessions

We have a Magento 1.9 installation, which we've moved from one to another server. We did an update from 1.7.2 to 1.9. Since we did that, the frontend sessions seem to get cleared within a time span of ...
1
vote
0answers
59 views

Magento 2.2.8 session_start slow in profiler

We have multiple Magento 2.2.8 websites on one domain (domain.com = Website A, domain.com/store = Website B - separate customer accounts, but often people are registered on both). We're having ...
0
votes
1answer
49 views

Magento 2 : Separate home page for logged in and guest user [closed]

I want to show different home page for logged in user, Which event/plugin I can use for this ? Whenever logged in customer clicks on homepage he should be redirected to different url Logged-in ...
1
vote
2answers
62 views

How to get customer ID Magento 2.3.2

After logged in Magento frontend. I need to get ID of user on which account I am currently logged in. Please help.
1
vote
0answers
24 views

VAT Customer shipping goods to different country with billing address VAT magneto 2.2.3

Not sure how to get this working, if anyone has any idea will be appreciated for the time. My aim is to create a module to check if the customer passing two different countries in billing and ...
1
vote
0answers
25 views

Magento2 - Customer Session set one store to another store

Magento2 - I have setup 2 store like 1: default store view (home page) 2: English ( sub pages ) When I'm going to English store than login its working and get customer session but ...
2
votes
0answers
25 views

How to get the data from the Session in a CustomerData Object without breaking the guidelines?

9.10. The Request, Session, and Cookie objects MUST NOT be injected in an object constructor. They MUST be passed only as method arguments. from the Technical guidelines How to comply with this rule ...
0
votes
3answers
58 views

Magento 2 How to get customer info on resetpasswordpost controller?

Magento 2 How to get customer info on customer/account/resetpasswordpost controller? I am trying this code - echo "<pre>"; print_r($this->session->getData()); and getting this response ...
0
votes
0answers
14 views

Magento 2.3 Cache / Clear Fields

In my checkout steps I have created a few custom fields, and after I fill them out complete the checkout process and am back in store and put a new item in cart and proceed to check out, the same ...
0
votes
2answers
36 views

M2 | Customer is not detecting by $customerSession->isLoggedIn()

I am trying to get loggedIn customer ID, I logged in and it is also showing in Online customer grid in the backend also can see on frontend. But if I check by $objectManager = \Magento\Framework\App\...
0
votes
0answers
17 views

Customer logged in report on magento2.3

Want to have a report to know each customer how many times logged in my Magento 2.3 site. If customer A comes 3 times in a day it should count just once not 3. I want to sort them by day, a weak, ...
0
votes
0answers
35 views

Magento 2 Customer and admin users are getting logged out frequently

My admin panel and frontend users are getting logged out frequently. I though have changed the store > configuration > Advanced > Admin > Security > Admin Session Lifetime (seconds) to 31536000 which ...
4
votes
0answers
174 views

Magento2: Local-Storage Mage-Storage and Mage-Cache Empty on every Reload

Many features in my web page break as when I investigated, I found out that many local storage keys don't even exist now which used to exist before. list of keys that don't exist: lo_session mage-...
0
votes
0answers
36 views

Magento 2 - current user session for adminhtml and frontend

I have an observer that applies to both frontend and adminhtml. I need to access the session of the authenticated user. The session for the frontend user is held in \Magento\Customer\Model\Session ...
1
vote
1answer
60 views

Customer session loggedIn() not working Magento 2

I have to check whether a customer is logged in or not. It only works for My account page and for the rest of the pages, it gives a null result. It was working before. $objectManager = \Magento\...
1
vote
1answer
14 views

how to find out where customer subscribed to newsletter from?

Is there anyway to find out where the customer sign up to newsletter from. i know the default way of subscribing is footer, but i am using the exact same way in different page also at checkout. Is ...
0
votes
0answers
58 views

Magento 2 - Call to a member function getId() on null, admin user ID

I have a custom module, and it's work perfectly in the past, and now I installed on a new Magento 2 project. and after that, I add the sample data module, and on setup:upgrade I get this error : ...
0
votes
0answers
27 views

Magento 2 Assign customer group name to externally calling JavaScript file variable

PreRequisites: MageVersion - Magento 2.3.x External JavaScript - http://domain.com/external-js.js var mage_customer_group = ''; //other code related to the customer group Pages - Category page and ...
0
votes
1answer
38 views

Tax/VAT field configuration is not working on multistore Magento2 Core

I have a multistory website as Retail-Website and Wholesale-Website Configuration with fresh Magneto2.2 at Store >> Configuration >> Customer Configuration >> Show Tax/VAT Number Retail-Website ...
0
votes
0answers
154 views

Magento2 Tax/VAT field not showing properly in customer registration based on admin configuration

I have Two Website in my magento2.2 webA & webB I want "Tax/VAT number" field in different scenarios on my website webA enabled and required webB enabled and optional I did the ...
3
votes
0answers
52 views

Using Customer Session Factory to avoid depersonalization

We have a plugin that adjusts the customer price on the frontend based on its customer ID. When you use the the Customer Session class it is depersonzalized for a very good reason. But when you use ...
0
votes
1answer
122 views

Magento 2 Session getting reset after placing order

Can anyone help me with this? I want some information from the session after order is placed. I tried customer session and even my own new session but after placing order am bot getting anything in ...
1
vote
0answers
18 views

Magento 2.1.15 - PHPSESSID changes from page to page

I am having an issue with Magento seemingly losing sessions and thereby logging users out. I have also noticed that the PHPSESSID cookie value seems to change within one user session. Is that the ...
0
votes
0answers
17 views

Magento 2 I cant able to get the session in Helper function

<?php namespace Sdi\Orders\Helper; use Sdi\Orders\Model\StubFactory; use \Magento\Framework\Module\Dir\Reader; use Magento\Framework\View\Asset\Repository; use Sdi\Orders\Model\EngravingFactory; ...
1
vote
4answers
318 views

How to make page non-cacheable in cms

I have added below code to load custom template file from cms. <p>{{block class="Vendor\Module\Block\Testblock" template="Vendor_Module::test_template.phtml"}}</p> If template is loaded ...
0
votes
2answers
74 views

Magento 2: How to increase customer login session?

I want to increase customer login session. Please tell me how can i do?
0
votes
0answers
26 views

How to get custome token in PHTML magento 2

I need to add products in the cart using rest api in javascript. Code is below: var data = JSON.stringify({ "cartItem": { "sku": "240-LV08", "qty": 1, "quote_id": "4" } }); var xhr =...
2
votes
1answer
214 views

customer first name and last name separately (Magento 2)

I am trying to get First Name and Last Name from the session. But I am not able to get First name or last name. Instead, I am able to get the full name. $objectManager = \Magento\Framework\App\...
3
votes
1answer
319 views

Magento 2.3: Customer ID from Session Returning NULL with Cache Enabled

I'm calling the following helper but getCustomerId is returning NULL when I have cache enabled. If I disable all cache, then I can return the customer's ID. <?php namespace Company\Module\Helper; ...
2
votes
2answers
297 views

How to restrict customer only to add products in cart Magento 2?

I need to integrate a functionality where when a user clicks add to cart it should check whether he is a logged in customer or not. If he is a logged in customer the product should be added in cart. ...
1
vote
2answers
811 views

Magento 2: check customer logged in by javascript use model

Just wanna to check if customer logged in by javascript use Magento_Customer/js/model/customer. I've included following js file in module: define([ "jquery", 'Magento_Customer/js/model/...
1
vote
2answers
256 views

Check on logged in customer, only working on cart page; why?

The check is as follows: The Following code is supposed to check if a customer is logged in anywhere $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $customerSession = $...
1
vote
2answers
23 views

Existing or New Customer on Checkout Success

We have some affiliate tracking on our site. On the success page we need to pass the tracking some information including whether it's a new or returning customer. I've tried a few things but I can't ...
1
vote
1answer
134 views

Database-Based & Redis-Based Customer-Session Empty Data Issue in Magento 2 Using 2 Web-Servers

I am facing a problem in getting session data in Magento 2, when I deploy my Build on 2 Web-Servers. I am facing no issue on Single Web-Server. Problem Details I am setting some data in session, in ...
1
vote
1answer
137 views

Customer not able to login and place order

I was looking for solution to my problem. We are using Magento 2.2.3 version and one of our customer facing problem when he logged in, His not able to purchase due session destroying every time he ...