Opencart Paypal Not Passing Shipping Address. How to solve.

OpenCart
3 мин. на чтение

Old versions of OpenCart (1.5.x, 2.0-2.2.x) are still very popular. This is a problem because most of them uses an old version of PayPal modules with a deprecated API. Today I will show you how to make a shipping address visible in your PayPal account.

If you are using standard OpenCart PayPal module shipping address is hidden by default and you need ask your clients every time about it. Good news — it’s very easy to fix that. If you want to see a shipping address in your transactions from client just update follow files:

catalog/view/theme/{{YOUR_THEME}}/template/extension/payment/pp_standard.tpl

Keep in mind to to update

YOUR_THEME

with your theme folder path.

Actually, I suggest to do changes for default theme and your (of course, if you are using it).

Found this block of code (string number should be +- same)

<input type="hidden" name="currency_code" value="<?php echo $currency_code; ?>" />
  <input type="hidden" name="first_name" value="<?php echo $first_name; ?>" />
  <input type="hidden" name="last_name" value="<?php echo $last_name; ?>" />
  <input type="hidden" name="address1" value="<?php echo $address1; ?>" />
  <input type="hidden" name="address2" value="<?php echo $address2; ?>" />
  <input type="hidden" name="city" value="<?php echo $city; ?>" />
  <input type="hidden" name="zip" value="<?php echo $zip; ?>" />
  <input type="hidden" name="country" value="<?php echo $country; ?>" />
  <input type="hidden" name="address_override" value="0" />
  <input type="hidden" name="email" value="<?php echo $email; ?>" />
  <input type="hidden" name="invoice" value="<?php echo $invoice; ?>" />
  <input type="hidden" name="lc" value="<?php echo $lc; ?>" />
  <input type="hidden" name="rm" value="2" />
  <input type="hidden" name="no_note" value="1" />
  <input type="hidden" name="no_shipping" value="1" />
  <input type="hidden" name="charset" value="utf-8" />
  <input type="hidden" name="return" value="<?php echo $return; ?>" />
  <input type="hidden" name="notify_url" value="<?php echo $notify_url; ?>" />
  <input type="hidden" name="cancel_return" value="<?php echo $cancel_return; ?>" />
  <input type="hidden" name="paymentaction" value="<?php echo $paymentaction; ?>" />
  <input type="hidden" name="custom" value="<?php echo $custom; ?>" />
  <input type="hidden" name="bn" value="OpenCart_2.0_WPS" />

 

You need to update

<input type="hidden" name="no_shipping" value="1" />

to

<input type="hidden" name="no_shipping" value="2" />

According to PayPal API documentation this key:

Valid value is:

  • 0. Prompt for an address, but do not require one.
  • 1. Do not prompt for an address.
  • 2. Prompt for an address and require one.

Also it’s useful to update

<input type="hidden" name="address_override" value="0" />

to

<input type="hidden" name="address_override" value="1" />

In this case (again according to PayPal API documentation)

When you pass in address_override=1 or tax or shipping variables, PayPal displays the values in the payment widget. Also, PayPal hides the calculation widget, regardless of setting up shipping and tax rates in your Account Profile.

Don’t forget to clear you cache after all changes.

Ihor Chyshkala
Full Stack Software Engineer PHP ♥️JS IT Pro blogger
Rate author
Ihor Chyshkala author's blog
Add a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.