I am using CarThrob for purchasing places on training courses. Each course type (singing, acting, dance etc) is an entry. Each entry has a Matrix field used for options.

Matrix column names are: option_value (text), age-range (text), time (text), price (text), booked (P&T Pill), student_name (text).

I have CartThrob set so multiple quantities are always added as single items.

On my checkout page in the update_cart_form I would like the customer to be able to fill in the "Student name" field for each item.

At the moment I am getting the student_name input field displayed but as soon as you enter text into it and update it creates a duplicate field next to itself. I can't work out why?

This is my Update cart form.




                    {if first_row}
                                <th>Student Name</th>
                                <td><input class="short" type="text" name="quantity[{row_id}]" size="2" value="{quantity}" /></td>
                                {exp:cartthrob:item_options row_id="{row_id}"}
                                {if selected}
                                <td><input type="text" name="item_options[{row_id}][student_name]" value="{item_options:student_name}" /></td>
                                    <label class="checkbox" for="delete_this_{row_id}">
                                        <input type="checkbox" id="delete_this_{row_id}" value="yes" name="delete[{row_id}]">
                                        Remove item
                    {if last_row}
                            <tr class="shaded">
                                <td><button type="submit" value="weekend-courses/checkout" name="return" class="btn">UPDATE</button></td>




1 Answer 1


I don't think you need the row_id in the name attribute.

It should be like this

<input type="text" name="item_options[student_name]">
  • er, nope. I get 4 extra inputs...
    – Tim Print
    May 13, 2013 at 16:02
  • They all have {student_name} in. hmmm.
    – Tim Print
    May 13, 2013 at 16:03
  • If you haven't already, try placing <input type="text" name="item_options[student_name]"> outside the {exp:cartthrob:item_options} tag.
    – SyA
    Aug 6, 2014 at 16:55

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .