Preferred Payment Method Select Field on Payments

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM Preferred Payment Method Select Field on Payments

Viewing 1 reply thread
  • Author
    Posts
    • #26675
      M M
      Participant

      Hi, I am using WC Vendors along with WooCommerce Frontend Manager – Ultimate & WooCommerce Frontend Manager – Groups & Staffs. I need to add a select field that will indicate the vendor’s preferred payment method. I could not find any option regarding this. Can you guys help?

      Thanks

    • #27099
      WCFM Forum
      Keymaster

      Hi,

      Thanks for get in touch with us.

      I am sorry for delayed response.

      Here is your code for the purpose –

      function wcfm_wcvendors_settings_fields_custom_billing( $billing_fields ) {
      	global $WCFM;
      	$vendor_id = apply_filters( 'wcfm_current_vendor_id', get_current_user_id() );
      	$prefered_payment_option = get_user_meta( $vendor_id, 'prefered_payment_option', true );
      	$custom_billig_fields = array(
      				"prefered_payment_option" => array( 'label' => __('Prefered Payment Option', 'wc-frontend-manager') , 'type' => 'select', 'options' => array( 'paypal' => 'PayPal', 'bank' => 'Bank Transfer' ), 'class' => 'wcfm-select wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele', 'value' => $prefered_payment_option, 'hints' => __( 'Set your prefered payment mode.', 'wc-frontend-manager' ) ),
      				);
      	$billing_fields = array_merge( $custom_billig_fields, $billing_fields );
      	return $billing_fields;
      }
      add_filter( 'wcfm_wcvendors_settings_fields_billing', 'wcfm_wcvendors_settings_fields_custom_billing' );
      
      function wcfm_wcvendors_settings_custom_update( $vendor_id, $wcfm_settings_form ) {
      	if( isset( $wcfm_settings_form['prefered_payment_option'] ) ) {
      		update_user_meta( $vendor_id, 'prefered_payment_option', $wcfm_settings_form['prefered_payment_option'] );
      	}
      }
      add_action( 'wcfm_wcvendors_settings_update', 'wcfm_wcvendors_settings_custom_update', 10, 2 );

      Thank You

Viewing 1 reply thread
  • The topic ‘Preferred Payment Method Select Field on Payments’ is closed to new replies.