If you exclusively use our WC Vendors Stripe Commission & Gateway plugin for transactions on your site you might wish to ensure that vendors have connected their Stripe Account before they can add (and sell!) products.
The below code can be used as a solution with WC Vendors Pro. This will disable add product buttons until they have connected their stripe account. It will also display a warning banner on the WC Vendors Pro vendor dashboard that will not be disabled until they do connect their Stripe account.
This code should be used in the theme/child theme functions.php:
if ( class_exists('WC_Gateway_Stripe_Connect') ) { // Hook into the dashboard add_action( 'wcv_pro_before_dashboard', 'add_stripe_notice' ); function add_stripe_notice( ){ $settings_page = WCVendors_Pro_Dashboard::get_dashboard_page_url( 'settings/#payment' ); $stripe_token = get_user_meta( get_current_user_id(), '_stripe_connect_access_key' , true ); WC_Vendors::log( $stripe_token ); // WC_Vendors::log( $stripe_token ); if ( empty( $stripe_token ) ){ echo '<div class="woocommerce-error">'; echo '<strong>WAIT!</strong> Before you can add products, you must connect to STRIPE, so you can receive the funds from your sales. <br /><br /> To connect to Stripe, <a href="' . $settings_page .'"><strong>VISIT YOUR STORE DASHBOARD SETTINGS</strong></a> and click the <strong>PAYMENTS</strong> tab.'; echo '</div>'; // disable quicklinks add_filter( 'wcv_dashboard_quick_links', 'disable_quick_links' ); // Lock add new products add_filter( 'wcv_product_table_lock_new_products', 'lock_products' ); } } // add_stripe_notice() // Disable quick links function disable_quick_links( $links ){ return array(); } // Disable add product function lock_products(){ return true; } }
The Message displayed in the WC Vendors Pro vendor dashboard will look like this: