Magento 2 API: Create New Customer

In this article, we will be looking into how we can create a new customer in Magento 2 using its API. We will be passing the admin bearer token to authenticate the APIs. Create New Customer API Doc: https://adobe-commerce.redoc.ly/2.4.5-admin/tag/customers Endpoint: GET <host>/rest/V1/customers Authentication Bearer Token: <admin-token> Payload: { "customer": { "firstname": "Test", "lastname": "Example", "email": … Read more

Magento 2 API: Get Customer Token

In this article, we will be looking into how we can get the customer token in Magento 2. Customer Users in Magento have access to resources with anonymous or self permission. To access the self resources, the API call should be authorized. In the Token-based Authorization method, the customer token is necessary to authorize the … Read more

Magento 2: Search Repository using SearchCriteriaBuilder, Filter & FilterGroup

This article shows how we can search Magento Repositories using SearchCriteriaBuilder that implements SearchCriteriaInterface. An example is provided of how we can perform search on Product repository in Magento. Similarly, we can search for other entities like Category, Customer, Order, Invoice, CMS Page, CMS Block, etc. We can add different conditions to build custom search … Read more

Magento 1 & 2: Join Collection to get Customer Fullname

This article shows how you can use the join query on any custom collection to get the customer firstname, lastname and contact firstname & lastname to get the customer full name. I will be showing example code for both Magento version 1.x and Magento version 2.x. Magento 1: Join Collection to get Customer Fullname I … Read more

Magento 2: Create, Edit, Delete Customer Attribute Programmatically

This article shows how you can programmatically add or create a new customer attribute in Magento 2. It also shows how you can update and delete/remove the customer attribute programmatically in Magento 2. I will also show how you can add the product attributes from both Install Script and Upgrade Script: – Add customer attribute … Read more

Magento 2: Create Customer Programmatically

This article shows how you can create customers programmatically (through code) in Magento 2.x. I have also written a similar article on Creating Customer Programmatically in Magento 1.x. In this example code, I will show how you can save a customer with general information like firstname, lastname, and email. I will also show how you … Read more