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.

2
  • Do you want to force them to input a shipping address on your site or at PayPal? Nov 3, 2014 at 16:39
  • @RyanSzrama At PayPal. I just need the shipping address in the "payment received" email from PayPal. Nov 3, 2014 at 23:42

2 Answers 2

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.

3
  • 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. Nov 5, 2014 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. Nov 5, 2014 at 19:07
  • Update: See WIP on drupal: - drupal.org/node/1494586 - drupal.org/node/1872804 - drupal.org/node/1301570 Nov 13, 2014 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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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