Home / eCommerce / Remove the “Apply to become a vendor” checkbox from the WooCommerce default customer signup form
Duplicate Snippet

Embed Snippet on Your Site

Remove the “Apply to become a vendor” checkbox from the WooCommerce default customer signup form

Code Preview
php
<?php
/**
 * Remove WC Vendors "Apply to become a vendor" checkbox from the WooCommerce default customer signup form.
 */
add_action( 'init', 'wcv_remove_vendor_registration_checkbox', 99 );
function wcv_remove_vendor_registration_checkbox() {
    global $wp_filter;
    $hook = 'woocommerce_register_form';
    if ( isset( $wp_filter[ $hook ] ) ) {
        foreach ( $wp_filter[ $hook ]->callbacks as $priority => $callbacks ) {
            foreach ( $callbacks as $id => $callback ) {
                // Check if the hooked function belongs to the WCV_Vendor_Signup class
                if ( is_array( $callback['function'] ) && isset( $callback['function'][0] ) && is_object( $callback['function'][0] ) && 'WCV_Vendor_Signup' === get_class( $callback['function'][0] ) ) {
                    // Unhook it
                    remove_action( $hook, $callback['function'], $priority );
                }
            }
        }
    }
}

Comments

Add a Comment