Questions tagged [customer-session]

Denotes questions regarding Magento customer session.

Filter by
Sorted by
Tagged with
0
votes
3answers
35 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
32 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
16 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
18 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
41 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
39 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.
0
votes
0answers
18 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
20 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
20 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
47 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
13 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
29 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
14 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
24 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
74 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
24 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
37 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
12 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
29 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
23 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
32 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
57 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 ...
2
votes
0answers
41 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
55 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
11 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
202 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
53 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
23 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
150 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
213 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
168 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
453 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
184 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
83 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
110 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 ...
1
vote
1answer
18 views

Customer Session Delay

I have a .phtml file that loops through dropdowns. There are 6 dropdowns belonging to two different groups (so 3 dropdowns per group). I set a session on button click: if ($this->getRequest()->...
0
votes
0answers
59 views

In Magento 1.9, how to access session id on the client side using javascript?

According to the following 2 answer, PHP session id is stored on the client side and with each request, the session id is sent to the server which is what helps the server in identifying the client. ...
0
votes
0answers
47 views

Magento 2 loginPost error

When I login in Magento 2 I get this following error. Fatal error: Uncaught TypeError: Argument 1 passed to Magento\Customer\Controller\Account\LoginPost::__construct() must be an instance of ...
1
vote
0answers
32 views

Get Voucher when you enter email address on a page

I want to give voucher code if user enters email address soon as they enter the email (Discount should be showed in page) I want to set cart rule for the voucher Is this possible?
1
vote
0answers
31 views

How to trigger reload window , after customer cookie lifetime expiration?

I want to achieve functionality, where the screen will automatically reload when customer cookie lifetime is expired. Currently, by default Magento expire cookie and session from the server side, but ...
0
votes
1answer
82 views

Magento 2 validate customer session with extra parameters

I have implemented Two factor authentication for customers. So customer logins from frontend and if they have entered login details correct then they will be redirected to our two factor ...
0
votes
2answers
1k views

Customer Session not working on full page cache in magento2

This is my code below $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $customerSession = $objectManager-create('Magento\Customer\Model\Session'); if ($customerSession-&...
0
votes
0answers
75 views

Does Magento 2 ever clean up it's own old sessions?

We currently have a production site with 4.2 GB of session data, dispersed over 2.8 million records. Some of these sessions are more than 1,5 year old! I was always in the assumption that Magento ...
2
votes
1answer
115 views

why I take session of other customer

I have a problem with a Magento2 installation. If I am logged in as a client on a browser, with another browser (client not logged in). If I do the same actions on both browsers, the second browser (...
0
votes
2answers
307 views

Magento2: Customer name is not showing on product page

When the cache is enabled customer name is not showing on the product page. When the cache is disabled customer name is showing properly on the product page. header.phtml <?php /** * Copyright ©...
1
vote
2answers
857 views

Magento 2 - get user email ID

I'm using Magento 2.2.6, How can I get the email ID of logged in user to show in header. Thanks.
4
votes
0answers
255 views

No such entity with cartId = 0 on checkout page

Customer lost session occasionally on checkout page. After login when i go to checkout page it's shows me below error but after refresh 4 5 times customer session restore again but after refresh ...
4
votes
2answers
39 views

Log User in programatically for Magento 2 (via Contoller)

I have a process in Magento 1 to log user in using the below; $session = Mage::getSingleton('customer/session'); $email = $this->getRequest()->getParam('email'); $password = $this->...