-- HikaShop version -- : 4.7.4
-- Joomla version -- : 3.10.11
-- PHP version -- : 7.4.2
Hi,
Often, the customer does not provide a shipping address. However, the Country for the shipping address is always set, even if the customer does not specify a shipping address. This leads to problems with paypal, because they get the country code and expect also a ZIP code and CITY then. Otherwise the payment fails.
Can you please adapt the paypal plugin to check all fields for the shipping address and add an else part with "NO_SHIPPING" ?.
in paypalcheckout.php:
Instead of:
if(!empty($order->cart->shipping_address)) {
please change to:
if(!empty($order->cart->shipping_address->address_firstname) && !empty($order->cart->shipping_address->address_lastname) && !empty($order->cart->shipping_address->address_street) && !empty($order->cart->shipping_address->address_city) && !empty($order->cart->shipping_address->address_post_code) && !empty($order->cart->shipping_address->address_country->zone_code_2)) {
If no shipping address is specified, it would also make sense to add the NO_SHIPPING parameter in the application_context.
Like this (if is same as above and then add else part):
if(!empty($order->cart->shipping_address->address_firstname) && !empty($order->cart->shipping_address->address_lastname) && !empty($order->cart->shipping_address->address_street) && !empty($order->cart->shipping_address->address_city) && !empty($order->cart->shipping_address->address_post_code) && !empty($order->cart->shipping_address->address_country->zone_code_2)) {
....
....
....
...
...
else {
$orderData->application_context->shipping_preference = 'NO_SHIPPING';
}
Thank you and best regards