PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Quantity Field depending on ID

  1. Bqbqr
    Member

    Hi!

    First of all i hope you will understand me, english is not my native language.
    I'm using this code to change the Quantity label:

    <?php add_filter("gform_product_quantity", "set_quantity_label", 10, 2);
     function set_quantity_label($sublabel, $form_id){
        return "Pour Combien de Personnes?";
    }
    ?>

    What I need to do is changing the Quantity label depending which product ID it is. I've a list of product ID which is quite big (50 entries at first), so the greatest thing for me will be to do a "If" in the function to see if the label has to be changed or not. But I don't know Php for now.... Do you guys have a simple solution?

    Thanks!

    Posted 11 years ago on Tuesday February 19, 2013 | Permalink
  2. If your products are all on one page, then all the products on that page will receive the new quantity label. That filter is per-form, not per-field.

    To change the label on the front end of the form based on the product (field) you could use jQuery.

    Posted 11 years ago on Saturday February 23, 2013 | Permalink