• Resolved Luká? ?leboda

    (@luigi7618)


    Hi,

    I use the plugin to populate fields with url parameters in woocommerce product. I read FAQ, so I use this code:

    <SCRIPT>
    cpcff_default = { 1 : {} };
    cpcff_default[1][ 'fieldname1' ] = productid;
    cpcff_default[1][ 'fieldname2' ] = productname;
    </SCRIPT>

    The thing I need to help with is how do I need to change this code if I use it in product loop, so there are 4 the same forms on one page. Now it populate only the first form.

    I left the fields displayed to see the issue.

    Thank you

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @luigi7618

    The first form on the page has the index 1, the second form the index 2, and so on. So, assuming there are two forms on the page the code would be:

    
    <SCRIPT>
    cpcff_default = { 1 : {}, 2: {} };
    cpcff_default[1][ 'fieldname1' ] = productid;
    cpcff_default[1][ 'fieldname2' ] = productname;
    cpcff_default[2][ 'fieldname1' ] = productid;
    cpcff_default[2][ 'fieldname2' ] = productname;
    </SCRIPT>
    

    Best regards.

    Thread Starter Luká? ?leboda

    (@luigi7618)

    It works well, thank you for your help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘populate field with url parameter in 4 form on one page’ is closed to new replies.