The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Custom Checkout Fields, only for certain category?

chriscoyierchriscoyier Member
in Bugs & Feature Requests edited January 2009
Is there a way to add custom checkout fields to the checkout screen, but only when a product of a certain category is added?

For example, we use a store for seminar registrations. This doesn't need any extra fields at all. We also use the store for selling a product that requires a host location to ship to. So we'd like to ask for that host location during checkout (couple of simple text fields).

It would be mighty confusing for someone trying to register for a seminar to be asked about a host location.

Is it possible to do this?
  • lukeluke FoxyCart Team
    Currently, you'd have to do it with JavaScript. Just check the cart json and if the products that require the custom fields you have setup don't exist, just add a class with display:none to the container for those fields.

    Post back if you need more details. In the future we'll also be developing a multi-template system... but that's for later. :)
  • brettbrett FoxyCart Team
    Fwiw, I've done this on a handful of implementations, and it really isn't too tricky (particularly if you know jQuery decently well). Like Luke said, let us know if you need help.
  • I wanted to do something basically like this. If a certain category was in the cart, then they would be asked to enter a Fax Number (Fax is not normally a field in checkout). You can see the original thread here.

    This is the modified code I'm currently using (It is in the checkout template). Theres an array that contains all of the categories that I want to trigger the Fax number to appear. If you only want one, you can probably get rid of the array and use the simpler code on the original thread.
    <script type="text/javascript" charset="utf-8">
    var specialCategories=new Array("custom_imprint_100","custom_imprint_251","custom_imprint_501","custom_imprint_751","custom_imprint_1001","custom_imprint_1401","custom_imprint_1701","custom_imprint_2001","custom_imprint_2500","custom_imprint_3001");
    var doSomethingSpecial = false;
    for (x in specialCategories) {
    for (i in fc_json.products) {
    if (fc_json.products [ i ] .category == specialCategories[x]) {
    doSomethingSpecial = true;
    if (doSomethingSpecial) {
    var faxcode = '<li class="fc_row fc_shipping_fax"><label for="Fax_Number" class="fc_label_left">Fax Number*</label><input type="text" name="Fax_Number" id="shipping_fax" class="fc_text fc_text_long fc_required" value="" /><label class="fc_error" style="display: none;" for="Fax_Number">Please enter your fax number. A valid fax number is required for custom imprint orders. <strong>If you do not have a fax number, please enter your email address in this field instead</strong></label></li>';

    The $j(".fc_customer_phone").after(faxcode); part places the code for the Fax Input immediately after the Phone number. Normally when you add a custom checkout field, it is put in a seperate category automatically, but I didn't want that.

    You should read the wiki about custom checkout fields. (
Sign In or Register to comment.