Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Marketplace (WooCommerce Multivendor Marketplace) › Add ACF Field to Store Settings
- This topic has 12 replies, 2 voices, and was last updated 5 years, 6 months ago by WCFM Forum.
- AuthorPosts
- November 3, 2018 at 3:56 pm #35640vinnycamposParticipant
Hi, I need to add new fields to my Store Settings:
– Image
– Text Area
– RelationshipHow can I do this?
What is the rules?
- November 3, 2018 at 4:56 pm #35641WCFM ForumKeymaster
Hi,
It’s very easy, but don’t worry I will give you sample code for this tomorrow morning.
Thank You
- November 3, 2018 at 4:57 pm #35642vinnycamposParticipant
Thank you
- November 4, 2018 at 12:45 pm #35691vinnycamposParticipant
Please send me step by step how to do, It will help me a lot!
- November 4, 2018 at 2:25 pm #35696WCFM ForumKeymaster
Hi,
Here is code for added new setting fields –
function wcfm_vendor_custom_0411_store_settings( $vendor_id ) { global $WCFM, $WCFMu; $wcfm_vendor_custom_options = (array) get_user_meta( $vendor_id, 'wcfm_vendor_custom_options', true ); $wcfm_vendor_invoice_prefix = isset( $wcfm_vendor_custom_options['prefix'] ) ? $wcfm_vendor_custom_options['prefix'] : ''; $wcfm_vendor_invoice_sufix = isset( $wcfm_vendor_custom_options['sufix'] ) ? $wcfm_vendor_custom_options['sufix'] : ''; $wcfm_vendor_invoice_digit = isset( $wcfm_vendor_custom_options['digit'] ) ? $wcfm_vendor_custom_options['digit'] : ''; $wcfm_vendor_invoice_disclaimer = isset( $wcfm_vendor_custom_options['disclaimer'] ) ? $wcfm_vendor_custom_options['disclaimer'] : ''; $wcfm_vendor_invoice_signature = isset( $wcfm_vendor_custom_options['signature'] ) ? $wcfm_vendor_custom_options['signature'] : ''; ?> <!-- collapsible --> <div class="page_collapsible" id="wcfm_settings_form_vendor_custom_head"> <label class="fa fa-file-pdf-o"></label> <?php _e('Custom Setting', 'wc-frontend-manager-ultimate'); ?><span></span> </div> <div class="wcfm-container"> <div id="wcfm_settings_form_vendor_custom_expander" class="wcfm-content"> <?php $WCFM->wcfm_fields->wcfm_generate_form_field( apply_filters( 'wcfmu_settings_fields_vendor_store_invoice', array( "wcfm_vendor_custom_prefix" => array('label' => __('Custom No Prefix', 'wc-frontend-manager-ultimate'), 'type' => 'text', 'name' => 'wcfm_vendor_custom_options[prefix]', 'class' => 'wcfm-text wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele', 'value' => $wcfm_vendor_invoice_prefix ), "wcfm_vendor_custom_sufix" => array('label' => __('Custom No. Sufix', 'wc-frontend-manager-ultimate'), 'type' => 'text', 'name' => 'wcfm_vendor_custom_options[sufix]', 'class' => 'wcfm-text wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele', 'value' => $wcfm_vendor_invoice_sufix ), "wcfm_vendor_custom_digit" => array('label' => __('Custom No. Digit', 'wc-frontend-manager-ultimate'), 'type' => 'number', 'name' => 'wcfm_vendor_custom_options[digit]', 'class' => 'wcfm-text wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele', 'value' => $wcfm_vendor_invoice_digit, 'hints' => __( 'enter the number of digits here - enter <code>6</code> to display 42 as 000042', 'wc-frontend-manager-ultimate' ), 'attributes' => array( 'min' => 1, 'step' => 1, 'max' => 9 ) ), "wcfm_vendor_custom_disclaimer" => array('label' => __('Disclaimer', 'wc-frontend-manager-ultimate'), 'type' => 'textarea', 'name' => 'wcfm_vendor_custom_options[disclaimer]', 'class' => 'wcfm-textarea wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele', 'value' => $wcfm_vendor_invoice_disclaimer ), "wcfm_vendor_custom_signature" => array('label' => __('Digital Signature', 'wc-frontend-manager-ultimate'), 'type' => 'upload', 'name' => 'wcfm_vendor_custom_options[signature]', 'class' => 'wcfm-text wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele', 'value' => $wcfm_vendor_invoice_signature ), ) ) ); ?> </div> </div> <div class="wcfm_clearfix"></div> <!-- end collapsible --> <?php } add_action( 'end_wcfm_vendor_settings', 'wcfm_vendor_custom_0411_store_settings', 20 ); function wcfmu_vendor_custom_0411_store_settings_update( $user_id, $wcfm_settings_form ) { global $WCFM, $WCFMu, $_POST; if( isset( $wcfm_settings_form['wcfm_vendor_custom_options'] ) ) { $wcfm_vendor_custom_options = $wcfm_settings_form['wcfm_vendor_custom_options']; update_user_meta( $user_id, 'wcfm_vendor_custom_options', $wcfm_vendor_custom_options ); } } add_action( 'wcfm_vendor_settings_update', 'wcfmu_vendor_custom_0411_store_settings_update', 20, 2 );
Thank You
- November 4, 2018 at 2:27 pm #35697vinnycamposParticipant
What this code do?
- November 4, 2018 at 2:41 pm #35703WCFM ForumKeymaster
HI,
This is for adding new setting field for vendors.
You asked me code for this –
I need to add new fields to my Store Settings: – Image – Text Area – Relationship
This code will do the same for you.
Thank You
- November 4, 2018 at 3:05 pm #35705vinnycamposParticipantThis reply has been marked as private.
- November 4, 2018 at 3:25 pm #35709vinnycamposParticipant
Ok, I did, and it appear at Custom Setting, It’s possible to add ACF Fields??
- November 4, 2018 at 3:27 pm #35710WCFM ForumKeymaster
- November 4, 2018 at 3:51 pm #35713WCFM ForumKeymaster
Hi,
You may tweak this to fit with your ACF fields, use same meta names.
Thank You
- November 4, 2018 at 3:54 pm #35714vinnycamposParticipant
Can you show me an example? It must be using functions or the ACF Panel?
Because I can’t find where add the rules to show there.
- November 5, 2018 at 7:18 am #35765WCFM ForumKeymaster
Hi,
“Because I can’t find where add the rules to show there.”
– What do you mean by “rules”?
Thank You
- AuthorPosts
- The topic ‘Add ACF Field to Store Settings’ is closed to new replies.