• Resolved Sam

    (@ssharples)


    I have over 2000 woocommerce products which all need the form adding to it. Is there any way to assign a form to multiple products without having edit each products individually?

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

    (@codepeople)

    Hello,

    I’m sorry, but the plugin requires that the forms be associated to the products by separated. If you have created multiple forms, the plugin cannot assume you want associate a form in particular with all products.

    A possible solution, that will require some of code, would be implement a module to assign the corresponding metadata to the products.

    The metadatas used by the add-on to associated the forms to the WooCommerce products are:

    woocommerce_cpcff_form: The form’s id.

    woocommerce_cpcff_calculate_price: The possible values are 1 or 0. 1 means that the product’s price will be calculated by the form.

    woocommerce_cpcff_minimum_price: The minimum price allowed.

    woocommerce_cpcff_activate_summary: The possible values are 1 or 0. 1 means that you want generate a specific summary of submitted data, that will be displayed in the shopping cart and orders.

    woocommerce_cpcff_summary_title: A text, the title of summary.

    woocommerce_cpcff_summary: A HTML text with the special tags of the fields to include in the summary.

    The WooCommerce add-on is available in the versions “Developer” and “Platinum” of the plugin. If you have additional questions about the Woocommerce add-on, please, create a ticket in my personal website:

    http://cff.dwbooster.com/contact-us

    Best regards.

    Thread Starter Sam

    (@ssharples)

    Amazing, just what I needed! Thanks

    Thread Starter Sam

    (@ssharples)

    There may be a neater way but if anybody needs this in the future, here is how I updated products from a certain product category with a specific form:

    <?php

    $args = array(
    ‘post_type’ => ‘product’,
    ‘posts_per_page’ => -1,
    ‘product_cat’ => ‘YOUR_CATEGORY’
    );

    $myquery = new WP_Query( $args );

    if ( $myquery->have_posts() ) :
    while ( $myquery->have_posts() ) : $myquery->the_post();
    wp_update_post(array (

    ‘meta_input’ => array(
    ‘woocommerce_cpcff_form’ => 5 //YOUR FORM ID,
    ‘woocommerce_cpcff_calculate_price’ => 1
    )));

    endwhile; endif; ?>

    Plugin Author codepeople

    (@codepeople)

    Hello @ssharples,

    Thank you very much for sharing your solution.

    Best regards.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Add form to multiple products’ is closed to new replies.