Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [customer-session]

Denotes questions regarding Magento customer session.

1
vote
3answers
39 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
25 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
17 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
37 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\...
2
votes
0answers
40 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
44 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
60 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
34 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
19 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
43 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 ...
0
votes
1answer
25 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
15 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
30 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
30 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 ...
0
votes
0answers
24 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
28 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
39 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
363 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 ($...
0
votes
0answers
35 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
82 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
168 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 ©...
4
votes
0answers
147 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
36 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->...
0
votes
0answers
22 views

Magento 2.2 Create Order for customer from frontend As Sales Rep

Hi Magento Developers, I am having one scenario here, I have created customer group as Sales Rep. With this group, Sales Rep (as customers from frontend) can create new customers with General group. ...
5
votes
2answers
151 views

Customer logged out after checkout & redirected to empty shopping cart - Magento 1.9

I'm trying to find out why some logged in customers are being logged out of their accounts and redirected to an empty shopping cart after clicking the place order button in Magento. I am using ...
2
votes
2answers
121 views

load customer object update issue in magento 2?

I have used below code in my controller use Magento\Customer\Api\Data\CustomerInterfaceFactory; class editPost extends \Magento\Framework\App\Action\Action { protected $_customer; protected $...
1
vote
1answer
67 views

Fatal error in Constructor controller in Magneto2

I am creating sub user for current logged in customer below is my controller code use Magento\Framework\App\Action; use Magento\Framework\Exception\NotFoundException; use Magento\Framework\...
0
votes
2answers
41 views

Get current customer collection in custom account navigation link

I have created the custom link in customer account left navigation. I am successfully created it. I am trying to get current customer Data in template file. I am getting 500 server error. Below is ...
1
vote
0answers
76 views

Lesti FPC customer login/logout issue

I recently started using Lesti FPC in one of my M1.9 sites and for the most part it works pretty well. But I came across an issue with customer login/logout. To better explain the issue, let's say ...
0
votes
1answer
309 views

Magento2 customer login and registration session not working in frontend in chome? [closed]

I have successfully logged in firebox but customer session not working in chrome browser. Can anyone help me to get the solution? It's not localhost , am checking on linux server.
5
votes
3answers
772 views

How to get CustomerId in API in magento 2? and how magento gets customerId for the same?

Magento didn't load the customer session in API as used in web session based authentications. and i am aware about the API <magento.host>/rest/V1/customers/me My question is, how do I make ...
0
votes
1answer
80 views

Magento 2: How to manage simple user (customer) login session for different device?

Using Magento 2.2, I need to allow customer login only one device at a time. Ex. if the customer is already logged in the computer, but user tries to log in with a smartphone, the Magento will ...
0
votes
1answer
278 views

On customer register got an error message: “Cannot save the customer”

Couple of hours ago the registration worked well. Suddenly it is not working anymore. Reverted back my code changes and the problem still persists. What I've only done is to clear the cache. To get a ...
0
votes
0answers
129 views

Magento2: Display session expired message for frontend customers

I would like to add a message "Session expired. Please login" when customer session gets expired. For that I have configured: store/configuration/general/web/Default Cookie/Cookie Lifetime Is ...
5
votes
2answers
496 views

Difference between Session and SessionFactory in Magento 2

While working i found there are two methods of getting customer data using two session classes 1.) \Magento\Customer\Model\SessionFactory $customerSession 2.) \Magento\Customer\Model\Session $...
0
votes
1answer
304 views

Magento 2 : Get Customer logged in details not Working on list.phtml

The code bellow isn't working on product listing page: $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $customerSession = $objectManager->get('Magento\Customer\Model\...
0
votes
0answers
153 views

Programmatically log user in with dynamic user session cookie life time

How to set a dynamic session cookie lifetime while logging the user programmatically. I know a common session cookie lifetime can be set via core config web/cookie/cookie_lifetime. But I need to ...
0
votes
0answers
160 views

Magento 2 customer session data not giving customer data

I have a magento application build on Magento 2.1.4 . Earlier it was working fine. Now I am getting very weird situation. When I logged in it shows other users details and their last order on home ...
1
vote
0answers
42 views

Magento2 : limit concurrent logins for the same customer account

I want to limit concurrent logins for the same customer account. If customer already logged in one device and also try to login from another device then customer should be logout from previous session....
0
votes
2answers
251 views

Magento 2 + How to share cart for guest users between multi websites

I have a magento 2 website where I want to share cart between websites (for logged in users and guest users). For ex. guest user added product1 to the cart from website1 and now user switches to ...
0
votes
0answers
17 views

Magento 2.1.7 order went to different customer account

I know this was very broad question, but this caters the security of the customer's account on Magento 2.1.7. Though my Session Validation Settings > Use SID on Storefront was set to No for some ...
0
votes
1answer
174 views

How to access custom data from a customer session in JS file?

Is there any way to access custom data stored in a customer session from a JS file ( without Ajax call ). Here is the code for controller: <?php namespace Company\Vendor\Controller\Index; use ...
0
votes
0answers
18 views

A particular customer is not login while others customers are login

When a particular customer let says CustomerA tried to login he's not able to logged in getting blank page after reaching on below URL:- mysite/customer/account/loginPost/ While others user can ...
0
votes
0answers
101 views

After logout, customer name still shows in header

In my project I integrated magento 2 and codeigniter. After Login from Magento I can access codeigniter also. I saved the session into a file. when I logout from codeigniter I will re-write the ...
7
votes
2answers
2k views

Magento 2 + Customer logged out automatically in checkout process

I have a strange issue on one of the site. When I log in or register as a new customer and adding few items in shopping cart. Then go to the checkout page it is automatically logged out the customer ...
0
votes
2answers
330 views

Customers being redirected to login page when logged in and loading the checkout page

I am using Magento 2.2.2 and have an odd problem. Below is an itemised route to the error. Existing customer logs in Customer adds a product to the basket Customer clicks the go to checkout button ...
0
votes
1answer
221 views

Magento 1.9 How to get Guest user id in CMS pages? [closed]

How to get Guest user id in CMS pages header section? Let me know your suggestions. Thanks.
2
votes
0answers
30 views

Magento2 : Best way to handle Multi Device login using REST API Auth

I am creating an auth token for mobile customer using /V1/integration/customer/token When I use the same customer credentials in Second mobile device the first auth token is invalidated as the ...
0
votes
2answers
48 views

Get Email Address for a user from outside of Magento

In Magento 1, we could simply, umask(0); Mage::app('default'); Mage::getSingleton('core/session', array('name' => 'frontend')); if (empty($sessionCustomer)) { $sessionCustomer = Mage::...
0
votes
1answer
53 views

Magento 1.9 - Customers can't login to frontend [Page refreshes]

Customers can't log into the frontend of the site after development. The two test customers we used to test the site before the migration can login to the site perfectly but every other customer can'...