• Resolved calumjoyce

    (@calumjoyce)


    Hi there,

    I understand that in a previous reply you was able to add:

    function addon_uploads_section(){

    global $product;

    $products = array( ‘675’ );

    $addon_settings = get_option( ‘wau_addon_settings’ );

    if( isset($addon_settings[‘wau_enable_addon’]) && $addon_settings[‘wau_enable_addon’] === ‘1’ && in_array($product->get_id(), $products) ){
    $file_upload_template =
    ‘<div>’ . _e( ‘Upload an image:’, ‘woo-addon-uplds’ ) . ‘<input type=”file” name=”wau_file_addon” id=”wau_file_addon” accept=”image/*” class=”wau-auto-width wau-files” /></div>’;
    echo $file_upload_template;
    }

    }

    In order to limit to specific product IDs. Do you have an add_filter() that you can use in functions.php instead of editing the plugin files?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Ruchit Shah

    (@ruchitshah)

    Hi @calumjoyce

    I have passed on your request and we will release an update with the filter added in the code so that it is update friendly.

    Regards,
    Ruchit Shah

    Thank you @ruchitshah This is also important for me.

    Plugin Support Ruchit Shah

    (@ruchitshah)

    Hi @calumjoyce @paolobros,

    In order to limit to specific product IDs. You can have an add_filter() that you can use in functions.php
    Here is the code that you can now use with version 1.4.0

    
    add_filter( 'wau_include_product_ids', 'wau_include_only_product', 10, 1 );
    
    function wau_include_only_product( $pids ) {
        return array( 310, 315 ); // Add the product ID's here in the array.
    }
    

    I hope this code helps you.

    Regards,
    Ruchit

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

The topic ‘Limit to Specific Products Using functions.php’ is closed to new replies.