Hello,
I added two new product attributes to a product called
netsuite_internal_id & ava_tax_code
if I do a GET to /rest/V1/products/{sku}, I can see them in custom_attributes.attribute_code.
When a customer places and order I need those product attribute to show up in the "items" node. When doing a GET to /rest/V1/orders/{orderId}
Solved! Go to Solution.
@kouathawkrf1fa , That solution will do exactly what you want to do, just follow the steps and add your attribute there.
That blog is also changing the order data get API.
@kouathawkrf1fa , not required, you can get the data run-time, no need to insert in database.
No worries! With the below code’s help, we will learn How to Get Order Details with Custom Extension Attributes using REST API. So let us get started.
Hello @kouathawkrf1fa ,
You can use Extension Attributes for getting custom Attributes data in Order API, please refer this below doc for reference :
https://www.mageplaza.com/devdocs/how-get-value-custom-attribute-rest-api-magento-2.html
Hope it helps !
Below is my the GET order REST API.
"items": [ { "amount_refunded": 0, "applied_rule_ids": "2", "base_amount_refunded": 0, "base_discount_amount": 810, "base_discount_invoiced": 0, "base_discount_tax_compensation_amount": 0, "base_original_price": 810, "base_price": 810, "base_price_incl_tax": 810, "base_row_invoiced": 0, "base_row_total": 0, "base_row_total_incl_tax": 0, "base_tax_amount": 0, "base_tax_invoiced": 0, "created_at": "2021-06-17 19:07:24", "discount_amount": 810, "discount_invoiced": 0, "discount_percent": 100, "free_shipping": 1, "discount_tax_compensation_amount": 0, "is_qty_decimal": 0, "is_virtual": 0, "item_id": 131, "name": "SOLIDWORKS Standard 3-Month Term License", "no_discount": 0, "order_id": 131, "original_price": 810, "price": 810, "price_incl_tax": 810, "product_id": 5, "product_type": "simple", "qty_canceled": 0, "qty_invoiced": 0, "qty_ordered": 1, "qty_refunded": 0, "qty_returned": 0, "qty_shipped": 0, "quote_item_id": 158, "row_invoiced": 0, "row_total": 0, "row_total_incl_tax": 0, "row_weight": 0, "sku": "10465", "store_id": 1, "tax_amount": 0, "tax_invoiced": 0, "tax_percent": 0, "updated_at": "2021-06-17 19:07:24", "weight": 10 } ],
PRODUCT GET REST API
"custom_attributes": [ { "attribute_code": "netsuite_internal_id", "value": "10465" }, { "attribute_code": "ava_tax_code", "value": "DC010500" } ]
Pretty much I want to add those attributes code & value into the items node of the order rest api after weight.
Will the solution provided do that?
@kouathawkrf1fa , That solution will do exactly what you want to do, just follow the steps and add your attribute there.
That blog is also changing the order data get API.
Do I have to create the new column and set values for the existing orders? What are new columns?
@kouathawkrf1fa , not required, you can get the data run-time, no need to insert in database.
where it is the solution?