2

I am getting an issue like Invalid customer address id at

Magento\Framework\Exception\NoSuchEntityException(code: 0): Invalid customer address id 57 at vendor/magento/module-quote/Model/QuoteAddressValidator.php:79

Please let me know the exact reason for this issue.Sometimes my credentials work fine, sometimes getting issue while checkout.

2 Answers 2

2

I've checked it further and fixed this issue by overriding Magento's validateForCart function.

/**
 * Validate address to be used for cart.
 *
 * @param CartInterface $cart
 * @param AddressInterface $address
 * @return void
 */
public function validateForCart(CartInterface $cart, AddressInterface $address)
{
    $this->doValidate($address, $cart->getCustomer()->getId() ? $cart->getCustomer()->getId() : null);
}

The issue is with the customer Id passing in the function is null for the customers facing this issue.

0

$connection->query("update customer_entity ce set default_billing = null where default_billing is not null and default_billing != 0 and default_billing not in (select entity_id from customer_address_entity where parent_id = ce.entity_id);");

$connection->query("update customer_entity ce set default_shipping = null where default_shipping is not null and default_shipping != 0 and default_shipping not in (select entity_id from customer_address_entity where parent_id = ce.entity_id);");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.