1

i have an express-checkout page and the cart is shown but i have to give the customer the chance to remove items from his cart at this stage.

i edited the view Shopping cart summary (Commerce Order) by adding a (Line Item) Commerce Line Item: Delete button (Remove)

now when i click that button the form-validation starts and the item wont be removed. any chance to fix this? a multistep-form is not an option for me.

2

This is a pretty common support request, and the gist of it is you cannot use Views form functionality on Views embedded in the checkout form. The reason is pretty simple to understand - you end up nesting a FORM tag within a FORM tag because Views doesn't know that it's building form elements to render inside another form. The solution is not so simple.

The best advice I've been able to give thus far is to disable the cart contents checkout pane and create a Views block instead that uses the form functionality. However, if someone removes an item from the cart after making a change elsewhere on the page, the page would refresh and that data would be lost. Thus you'll want to figure out a way to have that remove button work via AJAX, which is totally possible through the forms API but remains undocumented as far as I know. If you do code a solution, a blog post about it or doc page on d.o would be great.

  • thank you ryan, i will try your advises / approach- for me as drupal / php beginner this will be a challenge :D spent some days now on form () ...heavy stuff but fomrs are essential. thanks. (if i could, i would vote) – user19578 Aug 7 '13 at 9:40
  • additional question: "...Views block instead that uses the form functionality..." what does form functionality mean? – user19578 Aug 7 '13 at 10:06
  • I'm referring to a View that becomes a form by including a field that renders as a form element; this is how we make quantity textfields and remove buttons on the shopping cart form, for example. – Ryan Szrama Aug 14 '13 at 2:01
  • @RyanSzrama, could you tell how to implement AJAX remove button? If we show button in view it becomes part of checkout suform. And ajax 'triggering_element' becomes always first button of checkout form. – milkovsky Oct 6 '13 at 20:01
  • @RyanSzrama, or anyone else really, is this still the only solution and if so is there any documentation available to help? – Andy Feb 5 '15 at 8:25

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.