Custom option titles are meant for shoppers and are often translated or changed over time, which makes them unreliable for connected systems such as an ERP, a production system or a fulfillment service. This module adds a fixed “Code” to every custom option and to every option value. When a customer orders, the codes of the selected options and values are saved with the order item and delivered together with the labels through the Magento order API.
Features
- New “Code” field for each custom option and for each value of select-type options (drop-down, radio buttons, checkboxes, multiple select) in the product’s Customizable Options section.
- The codes of the selected option and value are stored with each ordered item.
- The order API returns the option code, option label, value code and value label for every custom option of an order item.
- The option code is also added to the option’s container on the product page, so themes can style options by code (with Catalog Product Option Wrapper).
Configuration
Open a product in the admin, go to Customizable Options and enter a code for the options and values you want to identify. There are no global settings.
Good to know
Codes are only stored for orders placed after the module was installed and the codes were entered.
Installation
Install the module with Composer in your Magento root directory:
composer require infrangible/m2-catalog-product-option-codeThen enable it and update the store as described in the installation guide. Composer installs the required modules listed on this page automatically.