Php 未捕获错误:调用Magento 2中未定义的方法Magento\Quote\Api\Data\AddressExtension
我已经尝试在结账页面的发货和账单部分添加自定义字段(文本框)。 我有如下创建扩展属性:Php 未捕获错误:调用Magento 2中未定义的方法Magento\Quote\Api\Data\AddressExtension,php,magento2,magento-2.3,Php,Magento2,Magento 2.3,我已经尝试在结账页面的发货和账单部分添加自定义字段(文本框)。 我有如下创建扩展属性: <?xml version="1.0" ?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd&q
<?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="Magento\Customer\Api\Data\AddressInterface">
<attribute code="countrycode" type="string"/>
</extension_attributes>
</config>
谢谢。问题是extension\u attribute.xml文件
<extension_attributes for=""Magento\Customer\Api\Data\AddressInterface"">
<attribute code=""countrycode"" type=""string""/>
</extension_attributes>
以上代码应转换为
<extension_attributes for=""Magento\Quote\Api\Data\AddressInterface"">
<attribute code=""countrycode"" type=""string""/>
</extension_attributes>
请分享您在参考链接中遵循的所有步骤的代码。所以,对我们来说,解决这个问题很容易。
<extension_attributes for=""Magento\Quote\Api\Data\AddressInterface"">
<attribute code=""countrycode"" type=""string""/>
</extension_attributes>