beehexa integrationsidebar
beehexa beehexa logo 1

We Build HexaSync Integration Platform for Connecting ERP, POS, CRM, Accounting, and eCommerce Applications to Automate Business Processes

Magento 2 API (Updated 2024): Create The Personalization Option

In this post, I will show you how to create the personalization option for products using Magento 2 API

Let’s add a text box to the product page that allows the customer to add his name (up to 15 characters) to the back of the shirt.

Step 1: Generate Admin Access Token

Endpoint: POST <host>/rest/V1/integration/admin/token

Enter your admin username and password in the Body sections, then click Send.

{
  "username": "string",
  "password": "string"
}Code language: JSON / JSON with Comments (json)

Response: access token

Step 2: Create The Personalization Option

Create a new request and enter the admin access token

Authorization: Bearer token

Endpoint: POST <host>/rest/default/V1/products/options

Payload:

{
  "option": {
    "product_sku": "MH05-S-Green",
    "title": "Add Your Name (Max 15 Characters)",
    "type": "field",
    "sort_order": 1,
    "is_require": false,
    "price": 52,
    "price_type": "fixed",
    "sku": "Personalized",
    "max_characters": 15
  }
}

Code language: JSON / JSON with Comments (json)

API will return a response that has data like this:

{
    "product_sku": "MH05-S-Green",
    "Option_id": 6,
    "title": "Add Your Name (Max 15 Characters)",
    "type": "field",
    "sort_order": 1,
    "is_require": false,
    "price": 52,
    "price_type": "fixed",
    "sku": "Personalized",
    "max_characters": 15
}Code language: JSON / JSON with Comments (json)
API response the data after creating the personalization option
API response to the data after creating the personalization option

Step 3: Verify the personalization option

Log in to admin and select Catalog > Products. Click on the Hollister Backyard Sweatshirt simple product and expand the Customizable Options section.

The result of the personalization option
The result of the personalization option
Magento 2 API: How to create the personalization option

In this way, you can create the personalization option using Magento API. For more information, please refer to Magento DevDocs. If you have any questions or new ideas, feel free to leave a comment below.

Table of Contents

Ready to integrate and automate at scale ?

Learn how HexaSync lets you build enterprise-grade integrations and automations without having to code.

Receive Exclusive Productivity Tips Directly in Your Inbox

We’ll email you 1-3 times per week—and never share your information.

Get started for free

You can’t add more hours to the day. Beehexa is the next best thing.