protected $_customerRepositoryInterface; public function __construct( \Magento\Framework\App\Action\Context $context, \Magento\Framework\View\Result\PageFactory $resultPageFactory, \Magento\Customer\Api\CustomerRepositoryInterface $customerRepositoryInterface ) { parent::__construct($context); $this->resultPageFactory = $resultPageFactory; $this->_customerRepositoryInterface = customerRepositoryInterface; } Now execute function here reward_barcode is custom attribute: public function execute() { $customerId = 2; if ($customerId) { $customer...