1

I need to add additional fields in the customer's information form during checkout, such as Telephone number and "How did you hear about us?". I don't see within the Commerce pull-downs in the Admin panel any way to do that similar to how fields are added in other Drupal forms. I assume Commerce allows such customization. Of course that data needs to be added into the database records as well.

In addition, how are those additional fields added to the email that is generated when the order is completed? While the customer may not need it, other people within the ordering / fulfillment process are designated as getting copies of that email and need that information within the email.

2
  • Anyone have an answer?
    – marrer
    Nov 6 '17 at 19:03
  • I really need some assistance / guidance here. Anyone?
    – marrer
    Nov 21 '17 at 12:37
1

Adding additional fields to the customer

You'll want to add the fields to the customer profile:

/admin/config/people/profiles/manage/customer/fields

Editing the email text

According to the Commerce documentation:

Use the template file located in /commerce/modules/order/templates/commerce-order-receipt.html.twig.

3
  • Patrick: I almost have it, but seem to be missing passing something to the twig file. In the customer profile I added the field labeled "How did you hear about us?", which gave the machine name " field_how_did_you_hear_about_us_". . .That field shows up fine during the checkout process, and the value I place in it is correct on the "Review" page. But I am doing something wrong when adding the code to twig, as the checkout crashes. . . . (cont)
    – marrer
    Dec 1 '17 at 0:15
  • (cont) .. Is the correct way to write that variable " {{ field_how_did_you_hear_about_us_ }} "? I had also tried it with the "|t" ending as well with the same result. . . .Do I have to do something else at the beginning of the file to pass the variable/field into it? I had planned to purchase a book after the first of the year to learn Twig, but now that need seems to have been escalated.
    – marrer
    Dec 1 '17 at 0:18
  • See debugging twig templates. Dec 1 '17 at 0:45

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.