snowio / magento2-attribute-option-code
Installs: 202 854
Dependents: 0
Suggesters: 0
Security: 0
Stars: 10
Watchers: 4
Forks: 10
Open Issues: 1
Type:magento2-module
pkg:composer/snowio/magento2-attribute-option-code
Requires
- php: ^7.4||^8.1
- magento/framework: ^103
- magento/module-catalog: ^104
- magento/module-eav: ^102
Requires (Dev)
- rector/rector: ^0.8.56
- dev-master
- v3.2.0
- v3.1.0
- v3.0.2
- v3.0.1
- v3.0.0
- 2.x-dev
- v2.1.1
- v2.1.0
- 2.0.2
- v2.0.1
- v2.0.0
- v1.8.3
- v1.8.2
- v1.8.1
- v1.8.0
- v1.7.2
- v1.6.2
- v1.6.1
- v1.6.0
- v1.5.0
- v1.4.3
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.0
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.0
- v1.0.0
- dev-upgrade/PHP-8-1-compat
- dev-fix/constructor-bug
- dev-fix/option-add-update
This package is auto-updated.
Last update: 2025-10-26 14:42:55 UTC
README
Description
Magento 2 module that that adds a unique code to an attribute option. Attribute options can now be created by remote clients with an identifier (attribute option code) that the client can specify and later reference during product saves. Attribute options that were created with the client can also be deleted by specifing the attribute option code that belongs to the attribute option. Please refer to the endpoint table for uri endpoint paths.
Magento Versions
- 2.3.x use 2.x tags
- 2.4.x use master
Prerequisites
- PHP 5.6 or newer
- Composer (https://getcomposer.org/download/).
magento/framework100 or newermagento/module-eav100 or newermagento/module-catalog101 or newer
Installation
composer require snowio/magento2-attribute-option-code
php bin/magento module:enable SnowIO_AttributeOptionCode
php bin/magento setup:upgrade
Usage
Endpoint table
| HTTP Method | URI Path | Description |
|---|---|---|
| POST | /V1/coded-attribute-options |
Creates an Attribute option with a corresponding option code. See Creating a coded attribute option |
| DELETE | /V1/coded-attribute-options/entity-type/:entityType/attribute-code/:attributeCode/option-code/:optionCode |
Deletes an attribute option code. See Deleting attribute options for more information. |
| PUT | /V1/products-with-option-codes/:sku |
Saves a product with attribute option codes specified instead of attribute option IDs'. See Specifying attribute options in products for more information |
Creating a coded attribute option
Request message body (JSON)
{
"entity_type" : 4,
"attribute_code" : "testAttribute",
"option" : {
"label": "foo",
"value": "bar",
"sort_order": 0,
"is_default": true,
"store_labels": [
{
"store_code" : "testStore",
"label": "Foo Label Test"
}
]
}
}
Message body description
entity_typeinteger : The entity type that the attribute option corresponds to.attribute_codestring : The attribute code of the that corresponds to the optionoption:labelstring : The option labelvaluestring : The option codesort_orderinteger : The option's sort orderis_defaultboolean : default option flagstore_labels1..n :store_codestring : The store code for the optionlabelstring : The option label
Deleting attribute options
:entityTypeinteger : The entity type that the attribute option corresponds to.:attributeCodestring : The attribute code that the attribute option corresponds to.:optionCodestring : The attribute option code.
Specifying attribute options in products
URI parameters
:skustring : The products sku.
Request message body (JSON)
{
"product": {
"type_id": "simple",
"sku": "test-from-snowio-simple",
"attribute_set_id": 4,
"name": "test from snow.io simple",
"price": 10,
"visibility": 4,
"status": 1,
"custom_attributes": {
"testAttribute": "bar"
}
}
}
NOTE that the value of the custom attribute testAttribute is the attribute option code bar.
License
This software is licensed under the MIT License. View the license