-- HikaShop version -- : 3.1.1
-- Joomla version -- : 3.7.5
Hi
Lately I discovered an issue, that PayPal gives users this error message when trying to pay: There is a problem with your shipping Address - please return to the merchant and update... PayPal seem to be more strict now.
I tracked the issue to this line (112) in the PayPal payment plugin (paypal.php).
$vars['country'] = @$order->cart->$address_type->address_country->zone_code_2;
Problem is, it's empty. So I inserted a debug function that send me an email with @order object, so I could inspect the issue.
The array address_country doesn't have a child called zone_code_2, so it makes sense it's empty.
I know this is because of some custom work I've done. Country zone field is disabled, as I'm setting it manually based on language selection on the site (user is not able to change country).
on the user->registration.php file, I'm setting country by this code:
<input type="hidden" id="address_country" name="data[address][address_country]" value="<?php echo $result->zone_namekey; ?>" />
I've looked up the data I need through a mysql call. Looking at the database table hikashop_address, the user info is there, and also in the SESSION [hikashop_address_data]. I've compared data from setting country manually or through hikashop zone field selection. They were identical.
I did notice that on the last step page where the users address is displayed, there was a difference.
If I set the country using the zone field as you would normally, then the country is displayed on the nest step page where the address is confirmed.
If I set it manually, it is not displayed on this page. So I'm missing something here, and I believe this is key to the error I'm getting not from PayPal.
Can you give any guidance / pointers?
Thanks in advance