Log in
Helper

CurrentCustomer

Magento\Customer\Helper\Session\CurrentCustomer

What it does

This helper provides a safe way to retrieve the current customer's data, considering caching scenarios.

When Full Page Cache is enabled and the page is cacheable, it returns a depersonalized customer (only group ID) to prevent caching personalized data.

Developers use this when they need customer information in blocks or view models that might be cached.

Public Methods

  • getCustomer()
  • getCustomerId()
  • setCustomerId()