Would adding the following code work to enable Virtual Downloadable? Then I just need a solution to hide the options all together.
add_filter( 'product_type_options', 'autocheck_vd');
function autocheck_vd( $arr ){
$arr['virtual'] ['default'] = "yes";
$arr['downloadable']['default'] = "yes";
return $arr;
}
Hi @daileycon, thanks for reaching WCMp Support!!
In order to set Simple product only, goto WCMp >> Settings >> Capability and enable only “Simple” product option. (see this screenshot – https://prnt.sc/m3ab6d )
Now, to remove the mesasge “For other product types go to WP backend “, add this css via WCMp >> Settings >> Vendor >> Vendor Frontend >> custom css :
.add-product-backend {
display: none;
}
If you want to set “virtual” product enabled by default, then you have to do custom code. For this override the “add-product.php” template file, by copying it to yourtheme/dc-product-vendor/vendor-dashboard/product-manager/add-product.php
Now, check how the “downloable” option is enabled by default using 'type' => 'checkbox', 'dfvalue' => enable, 'dfvalue' => $is_downloadable, in this document – https://docs.google.com/document/d/1f99_M7k1KB6X02I5b2R0uq0UX8H_3r8A0eYl-I3BvIU/edit?usp=sharing. Apply the same logic for $is_virtual.
Let us know if you have any further query.
I’ve tried every way possible and I just can’t get Virtual and Downloadable to be auto checked.
@daileycon, we have released an update today with new add product flow, as you can see here – https://docs.google.com/document/d/1P7fq4Y5JWH7pS1Go5DI-rKOYapZ3verEbvuROFF1cuM/edit?usp=sharing
As this is our major update, we would request you to update the plugin first in staging and then add the same on live.
After updating WC Marketplace, delete the overridden template file. Then add this code to the function.php of the current active theme :
add_filter( 'wcmp_afm_product_type_options', 'autocheck_vd');
function autocheck_vd( $arr ){
$arr['virtual'] ['default'] = ""yes"";
$arr['downloadable']['default'] = ""yes"";
return $arr;
}
I can’t get that code to work after the update.
@daileycon, we have checked this code on our end, working properly.
Now, as this is not working for you, can you please get in touch with us over our forum, so we can help you out further – https://wc-marketplace.com/support-forum
@daileycon, Sorry, we checked again.
Kindly replace that code with this one –
add_filter (‘wcmp_product_type_options’, ‘autocheck_wcmp_afm_product_type_options’);
function autocheck_wcmp_afm_product_type_options ($ arr) {
$arr['virtual']['default'] = "yes";
$arr['downloadable']['default'] = "yes";
return $ arr;
}