0

I'm using:

  • Drupal: 7-4.1
  • Webform: 7.x-4.12
  • Ubercart/webform intg: 7.x-3.0
  • Ubercart: 7.x-3.8

I am using this wonderful Webform module to add products to cart, all works ok, however, when added more that one item to the cart using multiple webform submissions then When I try to remove one item from the cart it says:

If you remove this product from your cart, all products associated with your form submission will also be removed. Are you sure you want to delete this product?

So my question is; is there a way to remove one single item from the cart without removing all?

0

Yes, but not with the module itself. You can build a custom module to modify UC Webform Integration to suit your needs. This would involve 3 parts:

  1. Implement a HOOK_form_uc_cart_view_form_alter() function such that cart Delete link for each submission and they have 2 arguments: cart/delete-form/$NID/$SID. You may need to adjust your custom module weight so that it executes after, uc_webform_form_uc_cart_view_form_alter().
  2. Implement a HOOK_menu() function that defines the new cart/delete-form/%/% path. uc_webform_menu() should give you an idea how it's done.
  3. Implement your own form/submission handler for the cart/delete-form/%/%. The function uc_webform_submission_delete_products_form() & uc_webform_submission_delete_products_form_submit() should give you an idea how it's done. The key thing here is you'll be adding something like $wf_sid = arg(3); and replacing isset($cart_item->data['webform_sid']) with $cart_item->data['webform_sid'] == $wf_sid so that only the selected submission is deleted instead of all submissions on that form.
  • Thanks Shawn, I understand your suggestion, its a bit beyond my ability to execute but at least I know its possible. – mywebmasteruk Nov 15 '15 at 19:40

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.