Webinar registration for product variations only

June 8, 2016 2:03 pm

We offer CD-ROM recording as a product variation. These customers shouldn’t be registered for the live webinar. Currently, GoToWP doesn’t offer granular control and triggers regardless of the chosen product variation. Please add product variation support.

Thanks!

Published by 1 Comment

1 Reply

  • Here’s a function that might help in accomplishing this. This function puts a webinar key field on a product variation level and saves it to the product metadata. So if you can change the plugin to register users only when a webinar ID is entered there that would be great.

    Small additional thought: the ‘select service type’ really should be obsolete. Ideally, I think the plugin should just detect when a key is entered and then assume the service type to be Webinar.

    // Add Webinar ID variation settings
    add_action( ‘woocommerce_product_after_variable_attributes’, ‘variation_settings_fields’, 10, 3 );
    // Save variation settings
    add_action( ‘woocommerce_save_product_variation’, ‘save_variation_settings_fields’, 10, 2 );
    // Create webinar ID field on product variation level
    function variation_settings_fields( $loop, $variation_data, $variation ) {
    // Webinar ID Number Field
    woocommerce_wp_text_input(
    array(
    ‘id’ => ‘_number_field[‘ . $variation->ID . ‘]’,
    ‘label’ => __( ‘GoToWebinar ID’, ‘woocommerce’ ),
    ‘desc_tip’ => ‘true’,
    ‘description’ => __( ‘Enter GotoWebinar ID here.’, ‘woocommerce’ ),
    ‘value’ => get_post_meta( $variation->ID, ‘_number_field’, true ),
    ‘custom_attributes’ => array(
    ‘step’ => ‘any’,
    ‘min’ => ‘0’
    )
    )
    );
    }
    // Save product variation webinar ID in product metadata
    function save_variation_settings_fields( $post_id ) {
    // Webinar ID Number Field
    $number_field = $_POST[‘_number_field’][ $post_id ];
    if( ! empty( $number_field ) ) {
    update_post_meta( $post_id, ‘_number_field’, esc_attr( $number_field ) );
    }
    }

Leave a Reply

Your email address will not be published.