Iam using Magento 2.3.5-p2. I add custom field in the cart and checkout page which is successfully showing there.
In app\code\Company\Module\etc\di.xml
<preference for="Magento\Quote\Api\Data\AddressInterface" type="Company\Module\Api\Quote\Data\AddressInterface"/>
In app\code\Company\Module\Api\Quote\Data\AddressInterface.php
<?php
namespace Company\Module\Api\Quote\Data;
use Magento\Quote\Api\Data\AddressInterface as MagentoDataAddressInterface;
interface AddressInterface extends MagentoDataAddressInterface
{
const KEY_SUBDISTRICT = 'subdistrict_id';
public function getSubdistrictId();
public function setSubdistrictId($subdistrictId);
}
But while getting shipping estimate, it was error
Uncaught Error: Cannot instantiate interface Company\Module\Api\Quote\Data\AddressInterface in C:\wamp64\www\magento2-2\vendor\magento\framework\ObjectManager\Factory\Dynamic\Developer.php:50
I already
- Delete /generated/code
- Delete /static/frontend
- php bin\magento cache:clean