Add shipping address parameters to PayPal API request if available

Created on 7 January 2014, almost 12 years ago
Updated 18 August 2025, about 2 months ago

When a customer adds a shipping address to their order, the shipping address is not sent in the API request to PayPal.

Of course the shipping address exists and can be found on the order in Drupal Commerce, and then copied manually to PayPal to print shipping labels, but this takes a lot of extra time especially if there are a lot of orders.

I was able to temporarily get this working by adding the following lines to commerce_paypal_wpp.module, right before the api request line, but shouldn't this be a normal part of the module's function?

$shipping_address = $order_wrapper->commerce_customer_shipping->commerce_customer_address->value();

  $nvp += array(
    'SHIPTONAME' => substr($shipping_address['name_line'], 0, 25),
    'SHIPTOSTREET' => substr($shipping_address['thoroughfare'], 0, 100),
    'SHIPTOSTREET2' => substr($shipping_address['premise'], 0, 100),
    'SHIPTOCITY' => substr($shipping_address['locality'], 0, 40),
    'SHIPTOSTATE' => substr($shipping_address['administrative_area'], 0, 40),
    'SHIPTOCOUNTRY' => $shipping_address['country'],
    'SHIPTOZIP' => substr($shipping_address['postal_code'], 0, 20),
  );


// Submit the request to PayPal.
  $response = commerce_paypal_api_request($payment_method, $nvp, $order);

Thanks in advance!

✨ Feature request
Status

Closed: outdated

Version

2.0

Component

PayPal WPP

Created by

πŸ‡ΊπŸ‡ΈUnited States classicridge

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024