2

I have a line item type with a custom amount field that allows the user to specify the amount they pay for the product in the add to cart form.

I also want to be able to allow the user to update the amount at any stage up until they have paid.

How can I make it so that users can edit this line item on the checkout page?

Ideally I would like to just have the equivalent of the add to cart form with my editable amount field output on the checkout page but I'll settle for any way to edit the line item on the checkout form.

I would like to keep custom code to a minimum but am willing to do whatever it takes if my only option is to go very custom.

If it matters to the solution, orders that contain this line item will only ever contain the one product, with quantity 1 and the variable price.

These orders use Commerce NoCart and Commerce Checkout Multilane to skip the regular cart step.

[EDIT]

An idea I just had was to create a custom checkout pane with my form on it and a submit function that updates the line other on the order. Does anyone see any reason why that wouldn't work?

Or does anyone know if something similar already exists that I could modify/extend faster than writing something new?

1 Answer 1

2

Yep it seems my proposed solution should do the trick.

I somehow didn't previously see the Commerce Cart Form Checkout Pane module, which does pretty much exactly what I was asking for.

I also used the Commerce Line Item Cart Form module to add line item fields to the form.

[EDIT]
Turns out that those two modules I mentioned don't seem to play nice together so I'm just going to create a custom checkout pane with a custom form that updates the line item in it's submit function.

2
  • The custom checkout pane solution worked but it was fairly complex due to my requirements.
    – rooby
    Aug 5, 2015 at 0:04
  • Since no one else has chimed in with solutions yet I'm accepting this one.
    – rooby
    Aug 5, 2015 at 0:05

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.