Magento: Paypal is taking shipping address as default instead of billing address

Magento: Paypal is taking shipping address as default instead of billing address

August 24, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento: Paypal is taking shipping address as default instead of billing address

Fixing PayPal Address Issues in Magento

PayPal is a popular payment gateway for e-commerce platforms, including Magento. However, you’ve encountered an issue where PayPal defaults to the shipping address instead of the billing address during checkout using “PayPal Website Payments Standard”. Let’s dive into this problem and find a solution.

Understanding the Issue

When a customer checks out in your Magento store and enters separate billing and shipping addresses, the intent is that the payment should be associated with the billing address. However, when redirected to the PayPal site for payment processing, the system incorrectly defaults to using the shipping address as the primary address for the transaction.

This happens because of how Magento communicates with the PayPal API during the checkout process. By default, it sets address_override to 1, which tells PayPal to use the shipping address instead of the billing address for the payment.

Inadvertent Changes That Didn’t Resolve the Issue

You attempted to fix this by removing the line $request['address_override'] = 1; from the /app/code/local/Mage/Paypal/Api/Standard.php file. While this changes the API request, it doesn’t achieve your desired outcome because the issue lies deeper in the Magento core.

The Core Cause of the Problem

PayPal’s standard API expects a default address for the transaction. When Magento sends the addresses to PayPal, it includes both the billing and shipping addresses. By setting address_override to 1, you’re essentially telling PayPal to ignore the billing address and use the shipping address instead.

The Correct Way to Fix This Issue

To resolve this problem, we need to ensure that Magento only sends one address to PayPal—the billing address. We can achieve this by modifying a core file in your Magento installation.

  1. Open the /app/code/core/Mage/Sales/Model/Quote.php file.
  2. Locate the collectTotals method (line 703).
  3. In the if ($address->getIsBilling()) condition, add the following line:
$address->setAddressType('billing');
  1. Save and close the file.

This modification ensures that when Magento prepares the addresses for the PayPal API request, it explicitly marks the billing address as ‘billing’. This tells PayPal to use this address as the primary transaction address instead of the shipping address.

Conclusion

Addressing payment gateway issues in an e-commerce platform often requires a deep understanding of both the platform’s core and the third-party service’s API. In this case, a simple modification to the Magento core was necessary to align with PayPal’s expected behavior.

Remember that modifying core files can potentially lead to conflicts during updates. It is recommended to create a custom module that overrides the collectTotals method instead of directly editing the core file. This approach ensures your changes are preserved across updates and maintains the integrity of your Magento installation.

For more detailed guides on working with Magento, including creating custom modules and optimizing checkout processes, consider exploring our comprehensive resources at Laravel Company.

Checkout API Customers Errors

Our network