Skip to content

Instantly share code, notes, and snippets.

@nayemDevs
Created June 8, 2021 03:03
Show Gist options
  • Save nayemDevs/068609f38e23143686f6ff6a376bce87 to your computer and use it in GitHub Desktop.
Save nayemDevs/068609f38e23143686f6ff6a376bce87 to your computer and use it in GitHub Desktop.
Set I am a vendor by default
remove_action( 'woocommerce_register_form', 'dokan_seller_reg_form_fields' );
add_action( 'woocommerce_register_form', 'dokan_custom_reg_vendor_selected', 12 );
function dokan_custom_reg_vendor_selected() {
$postdata = wc_clean( $_POST ); // WPCS: CSRF ok, input var ok.
$role = isset( $postdata['role'] ) ? $postdata['role'] : 'seller';
$role_style = ( $role == 'customer' ) ? 'display:none' : '';
dokan_get_template_part( 'global/seller-registration-form', '', array(
'postdata' => $postdata,
'role' => $role,
'role_style' => $role_style
) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment