Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
deleted 132 characters in body
Source Link

I added a product custom attribute (type stringtext) through the admin interface.

Now I'm trying to save a product through the api rest but if I include the new attribute in the data passed I get this error:

Property "NeedsSync" does not have corresponding setter in class "Magento\Catalog\Api\Data\ProductInterface"

I've read about extension attributes but I'm not sure if that's the way to do this in particular case.

I've tried to add as extension attribute by adding a etc/extension_attributes.xml with this content:

<extension_attributes for="Magento\Catalog\Api\Data\ProductInterface">
    <attribute code="needs_sync" type="integer">
        <resources>
            <resource ref="Magento_CatalogInventory::cataloginventory"/>
        </resources>type="string">
    </attribute>
</extension_attributes>

I've also read about the way of definig database table and join in the extension_attribute.xml for this attribute but I'm not sure this is the correct way, as this is a eav attribute for product entity so it is not a new table...

I added a product custom attribute (type string) through the admin interface.

Now I'm trying to save a product through the api rest but if I include the new attribute in the data passed I get this error:

Property "NeedsSync" does not have corresponding setter in class "Magento\Catalog\Api\Data\ProductInterface"

I've read about extension attributes but I'm not sure if that's the way to do this in particular case.

I've tried to add as extension attribute by adding a etc/extension_attributes.xml with this content:

<extension_attributes for="Magento\Catalog\Api\Data\ProductInterface">
    <attribute code="needs_sync" type="integer">
        <resources>
            <resource ref="Magento_CatalogInventory::cataloginventory"/>
        </resources>
    </attribute>
</extension_attributes>

I've also read about the way of definig database table and join in the extension_attribute.xml for this attribute but I'm not sure this is the correct way, as this is a eav attribute for product entity so it is not a new table...

I added a product custom attribute (type text) through the admin interface.

Now I'm trying to save a product through the api rest but if I include the new attribute in the data passed I get this error:

Property "NeedsSync" does not have corresponding setter in class "Magento\Catalog\Api\Data\ProductInterface"

I've read about extension attributes but I'm not sure if that's the way to do this in particular case.

I've tried to add as extension attribute by adding a etc/extension_attributes.xml with this content:

<extension_attributes for="Magento\Catalog\Api\Data\ProductInterface">
    <attribute code="needs_sync" type="string">
    </attribute>
</extension_attributes>

I've also read about the way of definig database table and join in the extension_attribute.xml for this attribute but I'm not sure this is the correct way, as this is a eav attribute for product entity so it is not a new table...

Source Link

Magento 2 Product Custom Attribute in API rest

I added a product custom attribute (type string) through the admin interface.

Now I'm trying to save a product through the api rest but if I include the new attribute in the data passed I get this error:

Property "NeedsSync" does not have corresponding setter in class "Magento\Catalog\Api\Data\ProductInterface"

I've read about extension attributes but I'm not sure if that's the way to do this in particular case.

I've tried to add as extension attribute by adding a etc/extension_attributes.xml with this content:

<extension_attributes for="Magento\Catalog\Api\Data\ProductInterface">
    <attribute code="needs_sync" type="integer">
        <resources>
            <resource ref="Magento_CatalogInventory::cataloginventory"/>
        </resources>
    </attribute>
</extension_attributes>

I've also read about the way of definig database table and join in the extension_attribute.xml for this attribute but I'm not sure this is the correct way, as this is a eav attribute for product entity so it is not a new table...