Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Membership › remove vat field for one of the type of memberships
- This topic has 13 replies, 2 voices, and was last updated 4 years, 10 months ago by
HM.
- AuthorPosts
- April 22, 2020 at 11:16 am #121643
HM
ParticipantHello
my website is a multi vendor marketplace
For my membership’s plans I have “particular vendor” so they don’t have a vat number but it’s a Required Field for the inscription for the other plans and I was wondering if you can tell me how just for the “particular ones” I can remove the vat field ?
You can see it here :https://beantic.wpcomstaging.com/my-account/
you need to scroll down a little
and it’s for the last one
with price of 4,99
- April 22, 2020 at 12:39 pm #121666
Sarmistha Chakraborty
MemberHello,
Add this code in your theme’s functions.php
add_filter('wcfmu_settings_fields_vendor_store_invoice', 'wcfmu_settings_fields_vendor_store_invoice2204', 50, 2 ); function wcfmu_settings_fields_vendor_store_invoice2204($general_fields,$vendor_id) { $wcfm_vendor_invoice_data = (array) wcfm_get_user_meta( $vendor_id, 'wcfm_vendor_invoice_options', true ); $wcfm_vendor_invoice_storevat = isset( $wcfm_vendor_invoice_data['wcfm_vendor_invoice_storevat'] ) ? $wcfm_vendor_invoice_data['wcfm_vendor_invoice_storevat'] : ''; $current_plan = wcfm_get_membership(); if(isset($current_plan) && ($current_plan != 153) ) { //replace 153 with "“particular ones" membership plan id $general_fields['wcfm_vendor_invoice_storevat']= array('label' => __('Vat Number', 'wc-frontend-manager') , 'type' => 'text', 'class' => 'wcfm-text wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele','custom_attributes' => array( 'required' => 1 ), 'value' => $wcfm_vendor_invoice_storevat ); } return $general_fields; } add_action( 'wcfm_wcfmmp_settings_update','fn_wcfm_vendor_settings_storetype_update2204', 50, 2); add_action( 'wcfm_vendor_settings_update','fn_wcfm_vendor_settings_storetype_update2204', 50, 2); function fn_wcfm_vendor_settings_storetype_update2204($user_id, $wcfm_settings_form ){ $wcfm_settings_form_data_new = array(); $wcfm_vendor_invoice_data = (array) wcfm_get_user_meta( $user_id, 'wcfm_vendor_invoice_options', true ); parse_str($_POST['wcfm_settings_form'], $wcfm_settings_form_data_new); if( isset( $wcfm_settings_form_data_new['wcfm_vendor_invoice_storevat'] ) ) { $wcfm_vendor_invoice_data['wcfm_vendor_invoice_storevat'] = $wcfm_settings_form_data_new['wcfm_vendor_invoice_storevat']; wcfm_update_user_meta( $user_id, 'wcfm_vendor_invoice_options', $wcfm_vendor_invoice_data ); } }
Thanks
- April 22, 2020 at 5:34 pm #121796
HM
ParticipantHello
I have added the code but it’s not working
It still show the vat number field (“Numéro de TVA” in french)
You can try to create an account whith the membership priced 4,99 euros “ABONNEMENT POUR VENDEUR PARTICULIER” (last one on the right ) to see that
Chose the last option of payement who is “transfère bancaire” you will pay nothing and the account will be created for youAttachments:
You must be logged in to view attached files. - April 22, 2020 at 5:38 pm #121798
HM
Participantand the id here : if(isset($current_plan) && ($current_plan != 153) ) { //replace 153 with ““particular ones” membership plan id
was the right one already - April 22, 2020 at 5:39 pm #121799
HM
ParticipantCan you fix that please ?
- April 22, 2020 at 7:07 pm #121859
Sarmistha Chakraborty
MemberHello,
We just checked your site. Do you talking about “vat number” in this page https://beantic.wpcomstaging.com/vendor-membership/?vmstep=registration?
The above code was regarding “Store invoice” Vat number?
Can you share us the screenshot how/from where you add this “Vat number” in vendor registration page? any custom coding?
Then we will guide you specifically.Thanks.
- April 22, 2020 at 8:42 pm #121897
- April 22, 2020 at 10:55 pm #121954
Sarmistha Chakraborty
MemberHello,
Remove the custom field(VAT Number) which you have created from WCFM-settings.
Try this code in your theme’s functions.phpadd_filter('wcfm_membership_registration_fields_address', 'wcfmu_settings_fields_vendor_store_invoice2204', 50); function wcfmu_settings_fields_vendor_store_invoice2204($general_fields) { if(WC()->session->get('wcfm_membership') != 153) { $general_fields['wcfm_vendor_invoice_storevat']= array('label' => __('Vat Number', 'wc-frontend-manager') , 'type' => 'text', 'class' => 'wcfm-text wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele','custom_attributes' => array( 'required' => 1 ), 'value' => '' ); } return $general_fields; } add_action('wcfm_membership_registration','save_custom_vat_wcfm_membership_registration',10,2); add_action('wcfm_profile_update','save_custom_vat_wcfm_membership_registration',10,2); function save_custom_vat_wcfm_membership_registration($member_id, $wcfm_membership_registration_form_data) { //print_r($wcfm_membership_registration_form_data); if( isset($wcfm_membership_registration_form_data['wcfm_vendor_invoice_storevat']) ) { update_user_meta($member_id,'wcfm_vendor_invoice_storevat',$wcfm_membership_registration_form_data['wcfm_vendor_invoice_storevat']); } } add_filter('wcfm_profile_fields_general','custom_field_wcfm_profile_fields_general',10,2); function custom_field_wcfm_profile_fields_general($general_fields,$member_id){ $wcfm_vendor_invoice_storevat = !empty( get_user_meta($member_id,'wcfm_vendor_invoice_storevat',true) ) ? get_user_meta($member_id,'wcfm_vendor_invoice_storevat',true) : ''; $current_plan = wcfm_get_membership(); if(isset($current_plan) && ($current_plan != 153) ) { $general_fields['wcfm_vendor_invoice_storevat']= array('label' => __('Vat Number', 'wc-frontend-manager') , 'type' => 'text', 'class' => 'wcfm-text wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele','custom_attributes' => array( 'required' => 1 ), 'value' => $wcfm_vendor_invoice_storevat ); } return $general_fields; }
Thanks.
- April 23, 2020 at 4:16 am #122018
HM
ParticipantThis reply has been marked as private.- April 23, 2020 at 2:45 pm #122138
Sarmistha Chakraborty
MemberThis reply has been marked as private.
- April 23, 2020 at 4:17 am #122019
HM
ParticipantThis reply has been marked as private. - April 25, 2020 at 10:54 am #122804
HM
ParticipantThis reply has been marked as private. - April 25, 2020 at 2:44 pm #122879
Sarmistha Chakraborty
MemberHello,
Sorry, we didn’t get you. As per your earlier post your concern was “remove vat field for one of the type of memberships”.
And we have provided you the solution, did that work for you?
And it seems that this is your new query, so please create a new thread for new requirement.Thanks.
- April 25, 2020 at 5:13 pm #122918
HM
ParticipantThis reply has been marked as private.
- AuthorPosts
- You must be logged in to reply to this topic.