Skip to main content
25 votes
Accepted

How to use extension_attributes in Magento2

Suppose we create an order delivery date, when the customer select shipping then the customer can select a delivery date. So you can create a extension attribute for \Magento\Checkout\Api\Data\...
Sohel Rana's user avatar
  • 35.9k
16 votes
Accepted

Magento 2: Property does not have accessor method in class "Magento\Checkout\Api\Data\ShippingInformationExtensionInterface

You need to remove generated folder. Magento generates ExtensionInterfaces on the fly in developer mode or during setup:di:compile in production mode. If everything is ok with your xml it has to be, ...
Sebastian's user avatar
  • 518
12 votes

Extension attributes to add product attribute to the order summary on checkout?

1) The flow of cart summary in checkout page We can get the totalsData from: vendor/magento/module-checkout/view/frontend/web/js/model/quote.js var totalsData = window.checkoutConfig.totalsData; ...
Khoa TruongDinh's user avatar
11 votes

Magento 2 : What is difference between Extension Attributes and Custom Attributes?

Custom attributes are those added on behalf of a merchant. For example, a merchant might need to add custom attributes to product entity named ‘customizeable’ in which he want to save information that ...
Hassan Ali Shahzad's user avatar
10 votes

Magento 2 : What is difference between Extension Attributes and Custom Attributes?

Custom attributes are the attributes added to describe an entity, such as product attributes, customer attributes etc. These are a subset of EAV attributes. Extension attributes on the other hand are ...
hungersoft's user avatar
9 votes
Accepted

How to add extension attribute Magento 2

(Fortunately or not, but ) Join Processor (Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface) isn't used everywhere and in particular it is not used in Sales module. As result, extension ...
user40988's user avatar
  • 324
6 votes

Add extension attribute to Order

You need to add the below plugin to di.xml <type name="Magento\Sales\Api\OrderRepositoryInterface"> <plugin name="get_order_comment" type="Vendor\Sample\Plugin\OrderGet"/> </...
santhoshnsscoe's user avatar
6 votes
Accepted

Magento 2.1.3 : How can I add extension attributes to a product attribute?

If what you mean is adding extension attribute named Addition (model) for Product model, this may help you. Create or append extension_attributes.xml configuration. app/code/ProjectName/ModuleName/...
Rendy Eko Prastiyo's user avatar
6 votes
Accepted

Magento 2 REST - SKU to items on cart totals API response is not available, How to get SKU in response API

Extension attribute is the simplest way to achieve this. extension_attributes.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
Ramkishan Suthar's user avatar
5 votes
Accepted

Magento 2 - extension attributes interface

The getters and setters are not added to the TotalsInterface itself. Instead they are generated in Magento\Quote\Api\Data\TotalsExtensionInterface (which you should find in var/generation) and you ...
Fabian Schmengler's user avatar
5 votes

Magento 2 Product Custom Attribute in API rest

I figured it by myself... extension attributes are for more complex info. For this particular case where it is a "simple" custom attribute (of type string), the way for updating via API is just to ...
danielnavarro's user avatar
5 votes

Where is the extensions attribute magento 2 actually save in Database?

Currently, extension attributes are only about Web API. You need to save extension attributes manually using plugins on appropriate services. If you want to save Extension Attributes to DB than you ...
Hamendra Sunthwal's user avatar
4 votes
Accepted

Magento 2 - Losing data with extension attributes in bundle options collection

The documentation for extension attributes is not quite clear on what's the right way to use them and it seems like each entity type does it in a slightly different way. That being said, from my ...
Fabian Schmengler's user avatar
4 votes
Accepted

Trying to understand EAV attributes and extension attributes in Magento 2

I had to do something similar in a Twilio module I wrote, https://github.com/pmclain/module-twilio. I've included the relevant code for adding the custom address attribute sms_alert to the frontend ...
Pmclain's user avatar
  • 2,618
4 votes
Accepted

Extension attribute in quote item

Not sure, but the first thing I noticed in your code is that you write plugin for \Magento\Quote\Api\CartRepositoryInterface but should be for \Magento\Quote\Api\GuestCartTotalRepositoryInterface Upd ...
underser's user avatar
  • 550
4 votes

Adding extension attribute to customer in GraphQL Magento 2

Magento 2.4 Try This Code app/code/VendoreName/ModuleName/etc schema.graphqls type Customer { sample_attribute: String @doc(description: "Customer Custom Attribute Show") @resolver( ...
Msquare's user avatar
  • 9,133
4 votes
Accepted

Extension Attributes not storing data in database

That tutorial only shows you how to add new fields to default checkout forms but not mentioned how to save the field data (extension attribute value) into the database. To save the extension attribute ...
Tu Van's user avatar
  • 7,223
3 votes
Accepted

Creating Magento-attributes using Magento-Extension

Create a new module using silk software and check need Installing sql or php code and download the zip. After download open the sql file and paste the below code according with your modifications <...
Raghu's user avatar
  • 1,710
3 votes

class [] does not exist for custom extension_attributes over webapi

I finally manage to resolve this issue. After digging into the Magento core, I found that in the \Magento\Framework\Reflection\ExtensionAttributeProcessor::buildOutputDataArray method, Magento get the ...
eInyzant's user avatar
  • 331
3 votes

Save a custom attribute from shipping method to quote_address

Seem that you're wrong when trying to get the carrier office code $address->setCarrierOffice($address->getCarrierOffice()); It should be $address->setCarrierOffice($extAttributes->...
Khoa TruongDinh's user avatar
3 votes

Magento 2.1.3 : How can I add extension attributes to a product attribute?

Attribute type cannot be set to "array", it must be one of simple types declared in \Magento\Framework\Reflection\TypeProcessor, or data interface. It can also be an array, but item type should be ...
Alex Paliarush's user avatar
3 votes
Accepted

Difference between catalog_attributes.xml vs eav_attributes.xml vs extension_attributes.xml

catalog_attributes.xml It contains the list of attributes that serve different purposes. For example, the group used_in_autogeneration is for listing attributes that have the value autogenerated. The ...
Anshu Mishra's user avatar
  • 8,990
2 votes

Magento 2 how to save custom field added in the form of customer group?

Don't forget that a module needs a register.php file in it, and you must use bin/magento module:enable VendorName_ModuleName before it will show up!
GuruBob's user avatar
  • 131
2 votes
Accepted

Right way to implement getExtensionAttributes()

Magento updated the AbstractExtensibleObject::_getExtensionAttributes method to generate a empty object if it has no extension attributes https://github.com/magento/magento2/commit/...
Ryan Sun's user avatar
  • 186
2 votes

Right way to implement getExtensionAttributes()

I can partially answer my own question as I found out that the way the method is implemented in Magento\Catalog\Model\Product is definitely wrong and can lead to nasty bugs: If there is no ...
Fabian Schmengler's user avatar
2 votes
Accepted

Cannot send headers; headers already sent

You can not use echo here. Instead of echo you have to use return from this method : <?php class Baltech_Stock_Block_Adminhtml_Stock_Renderer_Size extends ...
Ashish Jagnani's user avatar
2 votes

Add extension attribute to Order

You can add extension attributes in Magento 2 Order data by creating aextension_attributes.xml file under etc folder. Get insight into extension attributes in Magento 2 by referring blog, Magento 2 ...
Rakesh Jesadiya's user avatar
2 votes

Saving order extension attribute to database

The answer is that extension attributes do not know where and how behave, only developer can implement logic which will process them, in your case - save to database. It is not an out of the box ...
Bartosz Herba's user avatar
2 votes
Accepted

Extra column in catalog_product_entity_tier_price not saving/updating in observer

for Magento\Catalog\Model\Product\Type\Price::setTierPrices get value from $extensionAttributes->getTitle() public function setTierPrices($product, array $tierPrices = null) { // null array means ...
Jonas  Chen's user avatar
2 votes
Accepted

Extension attribute for shipping method in Magento 2

I have got solution and logic.Just Just I have change all extension attribute name after that put condition on current shipping method. Now do your template changes using layout & templates. The ...
Pratik Maniar's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible