Edit in GitHubLog an issue

Step 5. Create the personalization option

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 shirt.

The product_sku is the sku of the configurable product. The sku specified in the payload is a string that is appended to the product_sku when a customer decides to purchase this option. Likewise, the price supplied in the payload is added to the configurable product price.

Endpoint:

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

Payload:

Copied to your clipboard
{
"option": {
"product_sku": "MS-Champ",
"title": "Add Your Name (Max 15 Characters)",
"type": "field",
"sort_order": 1,
"is_require": false,
"price": 10,
"price_type": "fixed",
"sku": "Personalized",
"max_characters": 15
}
}

Response:

Copied to your clipboard
{
"product_sku": "MS-Champ",
"option_id": 7,
"title": "Add Your Name (Max 15 Characters)",
"type": "field",
"sort_order": 1,
"is_require": false,
"price": 10,
"price_type": "fixed",
"sku": "Personalized",
"max_characters": 15
}

Verify this step

  • Log in to the Luma website and select Catalog > Products. Click on the Champ Tee configurable product and expand the Customizable Options section.

    Product page with configurable and simple products

  • On the Luma storefront page, search for Champ. Then click on the Champ Tee product.

    Search results

Congratulations! You've finished.

Order Processing with REST APIs Tutorial

  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.