---
title: "How to Get Quote Details with Custom Extension Attributes value using REST API In Magento 2"
url: "https://magecomp.com/blog/get-quote-details-with-custom-extension-attributes-value-using-rest-api-magento-2/"
date: "2021-02-06T10:00:25+00:00"
modified: "2025-02-20T09:41:03+00:00"
author:
  name: "Dhiren Vasoya"
  url: "https://magecomp.com/"
categories:
  - "How To"
  - "Magento 2"
word_count: 589
reading_time: "3 min read"
summary: "Hello Magento Friends,"
description: "Default Magento does not return custom extension attributes values. Learn How to Get Quote Details with Custom Extension Attributes value using REST API In M..."
keywords: "How To, Magento 2"
language: "en"
schema_type: "Article"
related_posts:
  - title: "How to fix Wrong Sales Order Email Sender Issue in Magento 2"
    url: "https://magecomp.com/blog/fix-wrong-sales-order-email-sender-issue-in-magento-2/"
  - title: "How to Filter by Multiple SKU on Admin Product Grid in Magento 2?"
    url: "https://magecomp.com/blog/filter-multiple-sku-admin-product-grid-magento-2/"
  - title: "How to Add Additional Column in Invoice PDF for Products Bundle in Magento 2?"
    url: "https://magecomp.com/blog/magento-2-add-additional-column-in-invoice-pdf-for-bundle-products/"
---

# How to Get Quote Details with Custom Extension Attributes value using REST API In Magento 2

_Published: February 6, 2021_  
_Author: Dhiren Vasoya_  

![How to Get Quote Details with Custom Extension Attributes value using REST API In Magento 2](https://magecomp.com/blog/wp-content/uploads/2021/02/How-to-Get-Quote-Details-with-Custom-Extension-Attributes-value-using-REST-API-In-Magento-2-1024x512.webp)

**Hello Magento Friends,**

Welcome to MageComp’s “How To” Magento Blog series. Today we will find out, How to Get Quote Details with Custom Extension Attributes value using REST API In Magento 2.
[![Magento 2 Speed & Performance Optimization Services](https://magecomp.com/blog/wp-content/uploads/2023/10/Magento-2-Speed-Performance-Optimization-Services-CTA-4.webp)](https://magecomp.com/magento-performance-optimization.html)

When the customer sends a quote for any product, it is essential for Magento 2 store owners to get quote information. Handle quote requests smoothly by including[ **Email Quote Pro Extension for Magento 2**](https://magecomp.com/magento-2-email-quote-pro.html). REST API is used to fetch data. Hence, you can use REST API to get quote details. Previously we have discussed [**How to Get Quote Information using REST API in Magento 2**](https://magecomp.com/blog/get-quote-information-using-rest-application-program-interface-in-magento-2/).
But if we have used custom extension attributes, default Magento does not return its value. To get quote Details with Custom Extension Attributes value using REST API in Magento 2, use the below steps.
## Steps to Get Quote Details with Custom Extension Attributes value using REST API In Magento 2:
**Step 1:** Firstly, go to the below path
**app\code\Vendor\Extension\etc\extension_attributes.xml**

And add the code as follows:
```
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
  <extension_attributes for="MagentoQuoteApiDataCartInterface">
        <attribute code="customattribute" type="string" />
    </extension_attributes>
</config>
```

**Step 2:** Now go to the below path
**app\code\Vendor\Extension\etc\di.xml**

And add the code as given below:
```
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
   <type name="MagentoQuoteApiCartRepositoryInterface">
        <plugin name="cart_extra_attribute" type="VendorExtensionPluginCartrepositoryplugin" />
    </type>
</config>
```

**Step 3:** Then, move to the below path
**app\code\Vendor\Extension\Plugin\Cartrepositoryplugin.php**

And add the code as below:
```
<?php
namespace VendorExtensionPlugin;

use MagentoQuoteApiDataCartExtensionFactory;
use MagentoQuoteApiDataCartInterface;
use MagentoQuoteApiDataCartSearchResultInterface;
use MagentoQuoteApiCartRepositoryInterface;
use MagentoFrameworkExceptionCouldNotSaveException;

class Cartrepositoryplugin
{
    protected $extensionFactory;

    public function __construct(CartExtensionFactory $extensionFactory)
    {
        $this->extensionFactory = $extensionFactory;
    }
     public function afterGet(CartRepositoryInterface $subject, CartInterface $quote)
    {
        $customattribute = $quote->getData('customattribute');
        $extensionAttributes = $quote->getExtensionAttributes();
        $extensionAttributes = $extensionAttributes ? $extensionAttributes : $this->extensionFactory->create();
        $extensionAttributes->setData('customattribute',$customattribute);

        $quote->setExtensionAttributes($extensionAttributes);
        return $quote;
    }
}
```

[![hyva theme development](https://magecomp.com/blog/wp-content/uploads/2025/02/hyva-theme-development-CTA-4.webp)](https://magecomp.com/services/hyva-theme-development/)

**Step 4:** Lastly, create **getquotedetails.php** in the Magento root directory and add the below code:
```
<?php
	$admindata = array("username" => "admin", "password" => "admin@123");
	$baseUrl = "http://yourdomain"; // your magento base url
	$ch = curl_init($baseUrl."/rest/V1/integration/admin/token");
	curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
	curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($admindata));
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Content-Lenght: " . strlen(json_encode($admindata))));

	$token = curl_exec($ch);

	$ch = curl_init($baseUrl."/rest/V1/carts/1"); // change cart id
	curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Bearer " . json_decode($token)));
	$result = curl_exec($ch);
	$result = json_decode($result, 1);
	echo '';
	print_r($result);
?>
```

After that run URL as below:
https://yourdomain/getquotedetails.php
## Conclusion:
Hence, with the help of the above steps, you can easily Get Quote Details with Custom Extension Attributes value using REST API In Magento 2. If you face any problem with the above code, let me know in the comment and I will help you out. Do share the article with your friends. Stay updated for more such Magento solutions.
[![Hire Magento Programmer](https://magecomp.com/blog/wp-content/uploads/2025/02/Hire-Magento-Programmer-CTA-4.webp)](https://magecomp.com/services/hire-magento-programmer/)

**Happy Coding!**


---

_View the original post at: [https://magecomp.com/blog/get-quote-details-with-custom-extension-attributes-value-using-rest-api-magento-2/](https://magecomp.com/blog/get-quote-details-with-custom-extension-attributes-value-using-rest-api-magento-2/)_  
_Served as markdown by [Third Audience](https://github.com/third-audience) v3.5.3_  
_Generated: 2026-08-26 04:48:17 UTC_  
