1

We our developing a Drupal 8 Commerce website that does not need anything to do with addresses

  • The products are all virtual: membership and event tickets.
  • The billing is using PayPal express which takes care of billing address.

Therefore we don't want to prompt the customer to fill in an address, or store an address, or give them an "addresses" tab on their profile. Please can anyone advise how to configure this scenario?

So far we have considered:

  1. Edit the commerce flow. The BillingInformation pane gets included via PaymentInformation. If we remove PaymentInformation it does suppress the prompt for address and suppress the creation of a profile, but unfortunately it seems to stop the payment step from working properly.

  2. Edit the customer profile form display to disable the address field. This does suppress the prompt for an address, but we find that an empty profile is created for every order.

  3. Delete the customer profile type. We didn't try it yet because it seems likely to break the site as the Commerce core code has various hard-coded references to that profile type.

As an secondary question, we'd also prefer not to enter an address for the store as it does not have a physical address. However the address seems to be mandatory and does not allow country=none. We have entered a dummy value which seems to work as so far we haven't seen it used. Can we trust the dummy address will never be used, and if so, would it be reasonable to say that the address ought to be an optional field?

  • How about settings standard dummy values and adjust css to display:none it all related pages? – Justme Jun 21 '18 at 7:42
3

The store address is used for calculating taxes. It doesn't have to be a physical store address, enter the address the business entity is registered to.

On the store edit form select a single "Allowed billing country". That will hide the country selector on all of your address fields.

Then go to admin/config/people/profiles/manage/customer/fields/profile.customer.address and under "Field overrides" select "Hidden" for each field. That will hide the other address subfields.

You need to be on the latest Commerce release for this to work.

(And yes, an empty profile with just the country code will be created for each order. There is no way around that currently)

  • Many thanks @Bojan. This seems similar to #2 that we tried as described in the question - it works fairly well except the profiles. I'll leave the question open for a while in case anyone has success customising PaymentInformation. I plan to raise a Feature Issue on Drupal.org - please comment if you don't want that. – AdamS Jun 25 '18 at 20:06
  • 1
    There's already one: drupal.org/project/commerce/issues/2905028 – Bojan Zivanovic Jun 26 '18 at 11:10
  • Thanks for the link. I see an unwanted empty "Payment information" box (whether using the patch or using the above method). I hid it by overriding wrapper_element = "container". If logged in, the whole "Order information" step is unnecessary. When I altered the flow to try and work around that I hit a bug drupal.org/project/commerce/issues/2981922. So it's sort of working but a bit awkward at the moment. – AdamS Jun 26 '18 at 21:22
  • 1
    Please open new issues. Looks like we'll have to keep working on this. Not collecting billing addresses is a new use case for Commerce 2.x, so this is fresh territory for us. – Bojan Zivanovic Jul 6 '18 at 14:46
  • Thanks @Bojan - I already raised issues for all the problems I know about and they are linked in the answer below. – AdamS Jul 9 '18 at 8:22
1

Credit: many thanks to @Bojan for the information in his answer, please join me in +1 to him. I created this new answer to explain some details more clearly and add some new factors that I have discovered.

1) To avoid the empty profile:

  • EITHER apply the "highly experimental" patch from this issue
  • OR derive your own class that extends PaymentInformation and cut out everything relating to profiles. However in that case you will hit this issue.

2) If there is just one payment method, this leads to an unwanted empty "Payment information" pane. One way to fix that is to alter the checkout pane and set wrapper_element = "container".

3) If there is just one payment method, then when logged in, the whole "Order information" step is not necessary. One way to fix that is to edit the checkout flow and move "Payment information" to the review step. However you will then hit this bug and need to apply the patch.

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.