PAYPAL – Shipping address error
-
Hi
After an update, I have issues with address. On my site, i implemented my own “local pickup” option. I do have the code to disable native WooCommerce address validation, but, it seems, newer version of PayPal is ignoring standard woo hooks and insists on having shipping address.
How do I bypass this check???
Thank you
Rudolf
-
Hi @rudolfl
Thank you for contacting Payment Plugins. The logic for how the address validation works has not changed in any of the recent plugin updates. The plugin still uses core WooCommerce to perform validaitons.
What is the exact error message that you’re receiving on the checkout page?
Is this with PayPal or another payment method like Google Pay?
Do you display a shipping address on your checkout page or are those fields filtered?
If you can share a product page url to your site so we can review that would be helpful.
Kind Regards
Hi
Debug log is at the end of this message. I currently disabled PayPal on the site (site is www,flowers24hours.com.au). I had to implement custom checkout to allow “local pick up” option. While it exists in WooCommerce, it is only available as a Gutenberg block and theme in use is not yet compatible, so had to improvise. My custom code detects local pickup method and disables validation of shipping fields. It works OK with Apple Pay and credit card payments, but fails for PayPal with error: “Please enter a valid shipping address”.
Here is the log:
2025-12-09T00:03:32+00:00 Error API error: Array
(
[url] => https://api-m.paypal.com/v2/checkout/orders
[method] => POST
[http_status] => 422
[request] => Array
(
[intent] => CAPTURE
[payer] => Array
(
[name] => Array
(
[given_name] => Rudolf
[surname] => Ladyzhenskii
)
[email_address] => rudolfl@rumatech.com
)
[payment_source] => Array
(
[paypal] => Array
(
[attributes] => stdClass Object
(
)
)
)
[purchase_units] => Array
(
[0] => Array
(
[amount] => Array
(
[value] => 269.90
[currency_code] => AUD
[breakdown] => Array
(
[item_total] => Array
(
[currency_code] => AUD
[value] => 269.90
)
[shipping] => Array
(
[currency_code] => AUD
[value] => 0.00
)
[tax_total] => Array
(
[value] => 0.00
[currency_code] => AUD
)
[discount] => Array
(
[value] => 0.00
[currency_code] => AUD
)
[handling] => Array
(
[currency_code] => AUD
[value] => 0.00
)
)
)
[items] => Array
(
[0] => Array
(
[name] => PX3 Noel Table Centre Piece - Standard Arrangement
[quantity] => 2
[unit_amount] => Array
(
[currency_code] => AUD
[value] => 134.95
)
[sku] => bwcqy9ihhs
[description] => Product ID: 8165. Variation ID: 8788
)
)
)
)
[application_context] => Array
(
[shipping_preference] => SET_PROVIDED_ADDRESS
[return_url] => https://www.flowers24hours.com.au/wc-api/ppcp_checkout_return/?_checkoutnonce=b6f499e85d
[cancel_url] => https://www.flowers24hours.com.au/checkout-rl-header/?ppcp_action=canceled
[brand_name] => Flowers 24 Hours
[locale] => en-US
)
)
[error] => Array
(
[name] => UNPROCESSABLE_ENTITY
[details] => Array
(
[0] => Array
(
[field] => /purchase_units/0/shipping/address
[issue] => MISSING_SHIPPING_ADDRESS
[description] => The shipping address is required whenshipping_preference=SET_PROVIDED_ADDRESS.
)
)
[message] => The requested action could not be performed, semantically incorrect, or failed business validation.
[debug_id] => 0f3298c5b80ad
[links] => Array
(
[0] => Array
(
[href] => https://developer.paypal.com/api/rest/reference/orders/v2/errors/#MISSING_SHIPPING_ADDRESS
[rel] => information_link
[method] => GET
)
)
)
)Hi @rudolfl
What action are you using to disable the shipping address validation? The reason the API request is failing is because your customer’s order requires shipping and the WooCommerce order does not have the shipping address info populated.
Since you have some custom code on your site, I recommend that you populate the WooCommerce order’s shipping address with your store’s address info. That will ensure there is a valid shipping address when PayPal’s API performs the validation.
Kind Regards
Hi,
Yes, exactly!
Firstly, why does payment plugin care about shipping?
Secondly, I am setting all address fields ‘required’ to false in case I use my own local pickup. This happily bypasses Woocommerce own checks. Something like this (just an extract from the code)
add_filter('woocommerce_checkout_fields', function($fields) {
if (strstr($chosen_shipping,"local_pickup") ||
strstr($chosen_shipping, "free"))
{
$fields['shipping']['shipping_address_1']['required'] = false;
$fields['shipping']['shipping_city']['required'] = false;
}
});PayPal plugin fails this flow. I did upgrade of PayPal plugin and WooCommerce itself at same time. It is possible that changes in Woo highlighted the issue in PayPal plugin.
I also tried to “fix” by using this code and it did not work: (not being called)
add_filter('woocommerce_cart_needs_shipping_address', function ($needs)
{
error_log("Check if need shipping - " . $needs);
$chosen_methods = WC()->session->get( 'chosen_shipping_methods' );
$chosen_shipping = $chosen_methods[0];
// Cater for both original site and dev site
if (strstr($chosen_shipping,"local_pickup") ||
strstr($chosen_shipping, "free"))
{
return false;
}
return $needs;
});I am getting the error upon clicking on the PayPal button to pay. Seem that plugin checks for address BEFORE order is recorded, so all my checks fail as they are pretty much done just before order is being processed by Woo.
Rudolf
Hi @rudolfl
Firstly, why does payment plugin care about shipping?
It’s PayPal’s API that cares about the shipping. The error message you’re seeing is coming directly from PayPal’s API because it expects a shipping address but one isn’t being provided. Even in the case of local pickup, there should be a shipping address provided.
Reviewing your checkout page, you have removed the shipping address fields from your checkout page even though your items require shipping. That’s why PayPal’s API is failing, because you don’t have a shipping address associated with the WooCommerce order.
If you go to the Advanced Settings page of the PayPal plugin, you have the option
Disable PayPal Shipping Addressenabled. That means you’re telling PayPal that you’re providing it with a shipping address.You need to use action
wc_ppcp_get_order_from_cartand make the following change:add_action('wc_ppcp_get_order_from_cart', function($order){
$order->getApplicationContext()->setShippingPreference('NO_SHIPPING');
}, 100);That will tell PayPal that it should not expect a shipping address and thus it will not perform any address validations.
Kind Regards
Thank you
Yes, I do have “
Disable PayPal Shipping Address” enabled. If I keep it on, PayPal uses PayPal address from account. Site is a flower delivery one offering both local pickup and delivery. Naturally, most people send to address different from their own address.Thank you for providing the hook. This is what I was after. I will try to implement it.
By the way, may be it can be added as an option in the plugin? Something like “allow checkout without shipping address” or like?
Thank you again
Rudolf
Just to confirm, the code you provided works very well
Thank you again
Rudolf
Hi @rudolfl
Thank you for confirming. We always appreciate a good review of the plugin. https://wordpress.org/support/plugin/pymntpl-paypal-woocommerce/reviews/
Kind Regards
You must be logged in to reply to this topic.