I'm using Drupal Commerce for a website and a big part of the payment tunnel is handmade, all the forms, submit.

I need to add a new part with the customer profile form to get the customer billing information before the payment.

I have the customer billing module who provide a form function (commerce_customer_profile_pane_checkout_form), I try to call this function with drupal_get_form() in my custom module to add the billing form.

Visually it works: I have the form. When I submit its data, I always get this error message.

The form has become outdated. Copy any unsaved work in the form below and then reload this page.

What can I do to avoid this?


With removing the token from the form my first solution can submit but the form doesn't work well (there is some ajax that doesn't work).

So I also try another approach, I see that in the order entity there is a field 'commerce_customer_billing' that is a Profile reference and became the profile form in the order admin edit form.

So what I try to do is to get this field programmatically and add it to my custom form for the front, I already do something like this but I can't remember how to proceed, and I can't find what I've done before.

I think the first step is to get the instance of the field

 $field_billy = field_info_instance('commerce_order', 'commerce_customer_billing', 'commerce_order');

But for the next steps I don't remember, and I can't find any help on the web

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.