0

Currently when adding items to cart, I have all users redirected straight to /checkout, but the problem arises is when users want to modify their cart contents.

I tried adding the Quantity Text Field, but no update button shows up. And I tried adding the delete button, but it doesnt delete anything.

enter image description here

1

It actually isn't possible, at least using the Views Forms functionality that we use to create the shopping cart form at /cart. The issue is that using a Views Forms field in a View turns the entire View into a form - as in, you get a new form element in the DOM that wraps around the entire View HTML. Because the cart contents checkout pane is already part of a form, you end up nesting a form within a form - which just doesn't work.

You have two basic options to work around:

  1. Alter your checkout form to embed custom quantity editing fields in that part of the checkout form. Difficult, not sure it's possible. (In the same vein, you could also figure out how to make Views Forms embeddable inside other forms - even more difficult, but probably more possible.)
  2. Use a custom block on /checkout to show the cart contents with a Views Form that saves updates asynchronously (not the default behavior). The idea there would be you'd have a form with quantity edit fields outside the checkout form that you'd be using to update the cart contents completely separate from whatever happens on the checkout form. I say you'll want to use AJAX to save the updates because you don't want to have someone submitting a cart update form after putting data into the checkout form elements below and losing data.

These two options work with the existing Views powered cart contents pane. If I had this scenario and owned the feature, I'd probably just create a custom checkout pane and eschew the Views powered form entirely.

1
  • thanks ryan.... guess its not possible going the easy route. Jun 22 '13 at 1:03
0

Did you look into the Commerce Extra module. It gives the following features

Improve quantity field by wrapping it with decrease/increase button links.

Also there is Commerce Add to Cart Extras

The initial version provides a views field handler ("Commerce Product: Quantity input field") that relies on the Views Form API (a part of Views 3 since RC1) to output a quantity textfield that turns the view into an add to cart form. The default quantity can be configured, and only products with a quantity larger than 0 are added to the cart.

1
  • These modules are great for dressing up the Add to Cart / Cart forms, but they would not be off assistance for editing quantities in the checkout form. Jun 22 '13 at 0:56
0

This seems to work ok to solve this problem. https://www.drupal.org/project/commerce_cart_form_checkout_pane

Have done some preliminary testing. Not sure how your meant to be able to include your own view as it suggests on the module page.

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.