I've been struggling the last couple of days trying to find a way to remove a single registrant from the checkout page. I'm not sure if this is the correct or best place to ask this question (apologies in advance if it's not).

I've successfully added a "Add another registrant" button under the registrant information fieldset, I haven't been able to find a way to remove a registrant from the form. For instance, if I select a quantity of 3 registrants to add to my cart, I'm presented with 3 fieldsets (all good so far). While filling out the registrant information I decide I've selected 1 too many registrants. I now have no way to remove a single registrant.

What I've done so far:
I thought I would be able to add a submit handler to a new submit button labelled "Remove Registrant", but I get hung up in the validation of the "The registration is for:" field -- I _thought_ that I could set the validation and submit handlers in the form alter (as properties of my new button), but it seems to ignore my request. Strangely, if I'm an anonymous user, the submit works and I'm able to remove the registrant fieldset on the checkout page (/checkout/#), but clicking "Continue to next step" throws up a number of notices that end in an "EntityMalformedException" and a fatal website error.

The process:
I've added a validation handler (_remove_registration_form_validate) where I unset the registrant fieldset, load the order find the appropriate item and decrement the quantity, then "rebuild" the form (form_state['rebuild'] = TRUE) and redirect back to the checkout page (displaying the registrant fieldsets).

Have I had an epic fail and missed something simple? I've been googling like a hooligan! Is there documentation I've missed, a philosophical approach fail, a property I haven't set in either the cart or the commerce_registration setup?

Interestingly, this seems to be indirectly related to this issue:
https://drupal.org/node/2081705

Comments

blacklabel_tom’s picture

Status: Active » Closed (works as designed)

Hi,

The easiest way I've found to do this is to go back to the cart and reduce the quantity by one.

Cheers

Tom