Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I would like to add also a field to enter the VAT number when doing a checkout.
What is the most appropriate method and is this even possible ?
I tried to add it to an order, but it's not shown in checkout. Under the checkout settings I don't find a place where I can add extra information. The VAT number would actually be a billing information property to be good. If not possible, I would just like to add it separately on the checkout field.
Comment | File | Size | Author |
---|---|---|---|
#12 | commerce-phone-number-valid-save.png | 7.35 KB | wesleymusgrove |
#12 | commerce-phone-number-invalid-input.png | 12.64 KB | wesleymusgrove |
#12 | commerce-phone-number.png | 10.62 KB | wesleymusgrove |
Comments
Comment #1
rszrama CreditAttribution: rszrama commentedThe easiest thing to do is add a VAT field to your Billing information customer profile type. Then it will show up on the checkout form, on the order view / edit pages, and in Rules data selectors and such.
Comment #2
JGO CreditAttribution: JGO commentedThanks a lot, this is perfect!
Comment #4
applynx CreditAttribution: applynx commentedThis solution seems to work because the VAT field is tied to the customer. Is there an easy way to include a field that will vary from order to order? My particular case involves a shopping cart where the customer can assign his own internal PO# to every order.
Thanks in advance!
Comment #5
applynx CreditAttribution: applynx commentedJust an update for anybody who needs a custom field that does not really belong in the customer billing profile (in my example, a PO# that the customer can enter for the order).
I installed Commerce Fieldgroup Panes (http://drupal.org/project/commerce_fieldgroup_panes) and added a field to the order entity (store -> configuration -> order settings). In manage fields, create a field group, then create a field and add it to the field group by dragging it under the field group and to the right (you will see a slight indent before releasing).
Then, in store -> configuration -> checkout settings you will see an unassigned pane with the name of the fieldgroup you just created. You can drag this pane into any step of the checkout, and the user-entered value of your field will be automatically added to the order object.
I hope this helps and that I am not violating board protocol by replying to a closed article. Like everything in drupal, this solution was awesome once I figured out what to do, but getting to that point was an adventure.
Comment #6
rszrama CreditAttribution: rszrama commentedAhh, awesome! I didn't know there was already a module for this out there - I'd been wanting to author one similar for some time. Glad to see hunziker beat me to it. : )
Comment #8
pardalman CreditAttribution: pardalman commentedAlmost what I need...
I would need this functionality but I need a diferent field to every line product in the order. I'm trying to add a date field to every product (selling tours).
Any ideas?
Thanks in advance.
P.S.: I guess in the worst case I could use this solution to add two different fields "start date" and "end date" since usually the customer will enjoy all the services bought in the order within this date range but would be a poor solution and it would need extra efforts contacting the customer to know the date for every service bought.
P.S.(2): Hope I explained my problem properly...
Comment #9
pardalman CreditAttribution: pardalman commentedSOLVED
"You can add a date field to your product line item type and expose that to the Add to Cart form. It's fairly new functionality, so it may not be documented."
Answered in: How to add a selectable date to a product without replicating SKU product
Comment #10
Fonkel CreditAttribution: Fonkel commentedThis looks almost as what I need:
I want to handle registrations for courses through commerce.
But some courses require extra information like 'name of children attending' while other courses (products) require the name of the partner / spouse.
How can I do this?
Comment #11
svouthi CreditAttribution: svouthi commented@applynx, thank you so much for posting your solution. Your step by step account of how you set up your field groups is also appreciated, as it took me a moment to understand what was necessary.
@StudioFonkel, if you didn't already solve your problem years ago, you might try Commerce Extra Panes and Commerce Rules Extra modules to show your fields in a conditional checkout pane.
Comment #12
wesleymusgrove CreditAttribution: wesleymusgrove commentedI needed to accept an optional phone number during checkout, but I didn't think the phone number field really belonged in the Billing Information pane. As you can see in the attached image, I wanted the phone number field to show up below the email address in the Account Information pane, which I renamed "Contact Information". Commerce User Profile Pane, Commerce Fieldgroup Panes, and Address Field Phone were all too feature-rich for my needs. I just wanted to simply add one field to the Account Information pane, validate and save it to the order, thereby persisting it through the checkout.
In my case, the simplest solution was to save the phone number in the $order->data array by adding a form field to the checkout form using hook_form_alter. Before saving it into the $order->data array, I do some validation stripping and formatting on future display.
Comment #14
drupalevangelist CreditAttribution: drupalevangelist as a volunteer commentedHi,
I am trying to add an custom input field for TIP Amount on a checkout page. Any suggestions?
Thanks.