Skip to content

Create attribute option via API for swatch attribute fails #10707

Closed
@bartlubbersen

Description

@bartlubbersen

Preconditions

  1. Magento 2.1.8
  2. PHP7

Steps to reproduce

  1. Create a select attribute
  2. Make this attribute use visual or text swatch
  3. Try adding attribute options through the API via POST /V1/products/attributes/{attributeCode}/options

Expected result

The attribute options should be added the same as without swatch options selected for attribute.

Actual result

Although the API is not giving any errors and returns true with code 200, the option is not added to the attribute.

Problem

The problem is due to the swatch module plugin EavAttribute, in this plugin the option value is overwritten by optionvisual or optiontext. This is because these are used for the tables in the back-end. However through the API it is only possible to enter a value for option. So the option you entered through the API is replaced by an empty value.

Metadata

Metadata

Assignees

Labels

Fixed in 2.1.xThe issue has been fixed in 2.1 release lineFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentbug report

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions