Skip to content

Instantly share code, notes, and snippets.

@nayemDevs
Created August 16, 2021 11:19
Show Gist options
  • Save nayemDevs/77275d52c67c1d73d59f0371027c2f1f to your computer and use it in GitHub Desktop.
Save nayemDevs/77275d52c67c1d73d59f0371027c2f1f to your computer and use it in GitHub Desktop.
Enable Downloadable & Virtual by default
/**
* Dokan product page downloadable and virtual force always checked
*/
function dokan_product_page_downloadable_virtual_checkbox_force_checked() {
if ( is_user_logged_in() && function_exists( 'dokan_is_seller_dashboard' ) && dokan_is_seller_dashboard() ) {
?>
<script>
(function($) {
var Dokan_Product_Virtual_Download_Checkbox_Customized = {
init: function() {
$('.downloadable-checkbox ._is_downloadable').prop('checked', true);
$('.virtual-checkbox ._is_virtual').prop('checked', true);
},
};
$(function() {
Dokan_Product_Virtual_Download_Checkbox_Customized.init();
});
})(jQuery);
</script>
<?php
}
}
add_action( 'wp_footer', 'dokan_product_page_downloadable_virtual_checkbox_force_checked' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment