Posted on Leave a comment

Restrict Add Product without Payment Setting

You may restrict vendor’s “Add Product” permission if they not yet setup their payment setting –

add_filter( 'wcfm_is_allow_pm_add_products', function( $is_allow ) {
global $wp;
if( wcfm_is_vendor() ) {
$vendor_id = apply_filters( 'wcfm_current_vendor_id', get_current_user_id() );
$vendor_data = get_user_meta( $vendor_id, 'wcfmmp_profile_settings', true );
$payment_mode = isset( $vendor_data['payment']['method'] ) ? esc_attr( $vendor_data['payment']['method'] ) : '' ;
$paypal_email = isset( $vendor_data['payment']['paypal']['email'] ) ? esc_attr( $vendor_data['payment']['paypal']['email'] ) : '' ;
$stripe_user_id = get_user_meta( $vendor_id, 'stripe_user_id', true );
if( !$payment_mode || ( ( $payment_mode == 'stripe' ) && !$stripe_user_id ) || ( ( $payment_mode == 'paypal' ) && !$paypal_email ) ) {
if( isset( $wp->query_vars['wcfm-products-manage'] ) ) {
wcfm_restriction_message_show( __( "Payment account not yet setup!", "wc-fronend-manager" ), false, true );
}
$is_allow = false;
}
}
return $is_allow;
}, 750 );

Posted on Leave a comment

Tweaks Overview

WCFM Dashboard is most flexible one, you may change anything as per your requirement very easily. Now if we create setting option for all these then it will be a painful job for you to find out the right one for your purpose.

We have kept possibilities to tweak those easily by adding 1-2 lines of code. You may add those codes in two ways –

  1. Add codes at your child theme’s functions.php
  2. Install code snippet (https://wordpress.org/plugins/code-snippets/) plugin and add using this

Find below, some of the most popular tweaks people looking for!

Posted on Leave a comment

Order Status with Label

WCFM Order listing page by default shows order status by icon. But you may change this and show status as icon+text as well.

You have to use this code snippet –

add_filter( 'wcfm_order_status_display', function( $label, $the_order ) {
$label .= '<br />' . wc_get_order_status_name( $the_order->get_status() );
return $label;
}, 50, 2 );

Hence it will look like this –