I have an order collection get out via API enter image description here

How can I change some value in API response via custom module enter image description here

  • Instead of changing existing attribute value , use extension_attribute for send additional data. – Hitesh Agrawal Oct 17 '19 at 7:59
  • I already know how to send more data, my problem is how to change the existing attribute value. – MichaelHa Oct 17 '19 at 8:07
  • As far as I understand, you want change product_option.extension_attributes.custom_options.option_value ? – underser Oct 17 '19 at 8:23
  • exactly, do you have any idea? – MichaelHa Oct 17 '19 at 8:24
  • @MichaelHa Are you able to resolve this issue? – Nitin Pawar Dec 23 '19 at 12:45

As far as I understand, this product_option.extension_attributes.custom_options.option_value it's a value that added via extension attributes.

In Magento 2 extension attributes are not magically saved to the database or populated, so based on this value above have to be added via plugin, observer or even rewrite.

The idea is to locate this logic which is responsible for filling that extension attribute and change as you want.

For example, if this is a plugin you can disable it via di, and create your own plugin which modifies the data.

  • Thank for the answer, Where does this value come from. how to find exactly. – MichaelHa Oct 17 '19 at 8:49
  • To help you with that, I need more information. Please update your answer: 1. Which REST endpoint you use? 2. Do you have any modules installed which are related to REST? 3. Which version of Magento you have? – underser Oct 17 '19 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.