• Resolved tsaba123

    (@tsaba123)


    Hi,

    I test a new marketplace but I stucked in a problem.
    In the wordpress level, in the Product editor the fields for downloadable files aren’t mandatory, but on the store level they are.
    I want to use an Order status control plugin which can set the status to complete after the payment, but it works with virtual & downloadable files, but I don’t have downloadable files as product.
    How I can solve this problem? I don’t need mandatory flag on the downloadable files from.

    Thank you.

    Best,
    Csaba Szilagyi

Viewing 1 replies (of 1 total)
  • Plugin Author WC Lovers

    (@wclovers)

    Hi,

    Yeah right, we have made downloadable fields mandatory for “downloadable products” as without those this product will not work.

    So, this actually help vendors to create product perfectly.

    If you want to remove this restriction then add this code to your site –

    add_filter( 'wcfm_product_fields_downloadable', function( $downloadable_fields, $product_id, $product_type ) {
    	if( isset( $downloadable_fields['downloadable_files'] ) && isset( $downloadable_fields['downloadable_files']['options'] ) && isset( $downloadable_fields['downloadable_files']['options']['name'] ) && isset( $downloadable_fields['downloadable_files']['options']['name']['custom_attributes'] ) ) {
    		unset( $downloadable_fields['downloadable_files']['options']['name']['custom_attributes'] );
    	}
    	if( isset( $downloadable_fields['downloadable_files'] ) && isset( $downloadable_fields['downloadable_files']['options'] ) && isset( $downloadable_fields['downloadable_files']['options']['file'] ) && isset( $downloadable_fields['downloadable_files']['options']['file']['custom_attributes'] ) ) {
    		unset( $downloadable_fields['downloadable_files']['options']['file']['custom_attributes'] );
    	}
    	return $downloadable_fields;
    }, 50, 3 );

    Add this code to your child theme’s functions.php
    In case you do not have child theme then add code using this plugin –?https://www.ads-software.com/plugins/code-snippets/

    Thank You

Viewing 1 replies (of 1 total)
  • The topic ‘mandatory fields for downloadable products?’ is closed to new replies.