0

I just built a store in Commerce using Drupal 7 and I am taking payments by the Commerce PayPal WPS submodule. However, when I tested checkout, I found it was possible to buy a product without supplying a shipping address.

In the PayPal Express Checkout documentation, it shows there is an option for forcing users to provide an address. However, the WPS documentation is less comprehensive and does not include any information about whether it is possible to force a shipping address to be displayed or not.

  • Do you want to force them to input a shipping address on your site or at PayPal? – Ryan Szrama Nov 3 '14 at 16:39
  • @RyanSzrama At PayPal. I just need the shipping address in the "payment received" email from PayPal. – Patrick Kenny Nov 3 '14 at 23:42
0

Have you tested this:

You need to activate the Shipping pane under checkout process:

  1. Go to Administration > Store settings > Advanced store settings > Checkout settings (admin/commerce/config/checkout),
  2. Check Shipping service under "Checkout pane configuration" or if you use recent version of DC move "Shipping information" pane from disabled panes section to Checkout section,
  3. Save.

enter image description here

If you want to alter data before sending, use the hook_commerce_paypal_wps_order_form_data_alter(). You need to fetch the customer shipping profile for the current order using commerce_customer_profile_load() and add the values you need from the shipping profile to the $data array.

  • As I mentioned in my comment to the question, I want PayPal to collect the address and include that in the "payment received" email. I don't want to collect the address on my site. – Patrick Kenny Nov 5 '14 at 18:29
  • Is not possible with WPS payments (at this time), you do retrieve data and sent to PayPal. PayPal Website Payments Standard (WPS) works as follows: Customer fills in name, email, billing and shipping info on the checkout form. – kxo Nov 5 '14 at 19:07
  • Update: See WIP on drupal: - drupal.org/node/1494586 - drupal.org/node/1872804 - drupal.org/node/1301570 – kxo Nov 13 '14 at 0:52
0

It turns out that there is a hook to override this. By default, Comerce tells PayPal not to collect a shipping address, but you can force this:

function MYMODULE_commerce_paypal_wps_order_form_data_alter(&$data, $order) {
  // Display a shipping address prompt at PayPal.
  $data['no_shipping'] = 0;
}

This way, you don't have to collect the shipping info at your site, but PayPal will still e-mail you the buyer's shipping address.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.