Hello, Magento mates.

Welcome to MageComp’s Magento tutorials.

Today, this tutorial is about getting a custom attribute value of an invoice for your Magento 2 store using REST API.

A custom attribute value of an invoice refers to additional, user-defined information that can be associated with an invoice. This feature allows you to extend the default set of attributes associated with an invoice by adding custom fields or values that meet specific business requirements.

Steps to Get Custom Attribute Value

Step 1 – 

First, we need to create an extension_attributes.xml file inside the etc folder 👇

app\code\Vendor\Extension\etc\

Using the code given below 👇

Step 2 –

Now, We need to create a di.xml file inside the etc folder.

app\code\Vendor\Extension\etc\

Step 3 – 

Then, we need to create the InvoiceRepository.php file inside the Plugin folder.

app/code/Vendor/Extension/Plugin/Api/

Step 4 –

Now, we need to run

You can see the values ​​of the custom attributes from the URL below.

BASE_URL/rest/all/V1/invoices/increment_id

Conclusion

Custom attribute values of invoices can be beneficial for Magento 2 store admins to display extra information related to an invoice, providing a flexible added feature for multiple Magento store needs and business scenarios.

These attributes can be managed and configured through the Magento 2 admin panel, allowing merchants to tailor their invoicing system to suit their unique needs.

This was it. If you have any queries related to this tutorial or any other Magento feature, kindly contact us, or hire our Magento developers to solve your queries.

MageComp Official Facebook Group

Happy Coding!!!

Click to rate this post!
[Total: 0 Average: 0]