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
1answer
6 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
13 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
17 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
13 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
26 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
44 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
8 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
16 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
84 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
35 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
20 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
70 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
0answers
114 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
73 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
198 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
82 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
22 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
60 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
58 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
16 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
39 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
35 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
25 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
30 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
60 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
663 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
50 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
98 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
230 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
204 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
37 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
28 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
160 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
177 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
73 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
43 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
89 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
487 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.
6
votes
3answers
1k 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 ...
1
vote
0answers
74 views

Magento 2 : Lifetime, scope and general usage for all types of sessions

There are a lot of session types in magento 2 . The ones I know of are listed below ; 1) \Magento\Catalog\Model\Session //vendor/magento/module-catalog/Model/Session.php 2) \Magento\Newsletter\...
0
votes
1answer
83 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
337 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
152 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
590 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
363 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\...
2
votes
0answers
50 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
292 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
1answer
191 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
108 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 ...
6
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 ...