Skip to content

Instantly share code, notes, and snippets.

@nayemDevs
Last active September 9, 2021 02:08
Show Gist options
  • Save nayemDevs/2ece4051ed257126e9e9075aa96347ff to your computer and use it in GitHub Desktop.
Save nayemDevs/2ece4051ed257126e9e9075aa96347ff to your computer and use it in GitHub Desktop.
Shipping class option required on single product page
function dokan_can_edit_product_shipping_filed_validation( $errors ) {
if ( stripslashes( isset( $_POST['_disable_shipping'] ) ) && 'yes' == $_POST['_disable_shipping'] ) {
$errors[] = __( 'Please select shipping option', 'dokan-lite' );
}
if ( $_POST['product_shipping_class'] < 1 ) {
$errors[] = __( 'Please select shipping class', 'dokan-lite' );
}
return $errors;
}
add_filter( 'dokan_can_edit_product', 'dokan_can_edit_product_shipping_filed_validation', 35, 1 );
@modabea
Copy link

modabea commented Sep 9, 2021

Help! I tried using it but my website crashed. Could you please help me?
P.S. I appreciate very much your hard work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment