Hi @virtual03
We have the problem that when local pickup is selected, an error occurs that the delivery address is incorrect
The PayPal plugin uses the shipping address that’s associated with the WooCommerce order.
The interesting thing about WooCommerce is when a local pickup shipping option is selected, it still renders the shipping address info rather than showing the delivery location.
I think the correct solution would be to update the WooCommerce order’s shipping address info using action woocommerce_checkout_create_order
.
Example (test first):
add_action('woocommerce_checkout_create_order', function($order){
$local_shipping = false;
foreach($order->get_shipping_methods() as $method){
if($method->get_method_id() === 'local_pickup'){
$local_shipping = true;
break;
}
}
if($local_shipping){
// all of the local pickup address info
$order->set_shipping_country('US');
$order->set_shipping_state('TX');
$order->set_shipping_address_1('');
$order->set_shipping_postcode('');
$order->set_shipping_city('');
}
});
Kind Regards