Add ACF Field to Store Settings

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!

Viewing 12 reply threads
  • Author
    Posts
    • #35640
      vinnycampos
      Participant

      Hi, I need to add new fields to my Store Settings:

      – Image
      – Text Area
      – Relationship

      How can I do this?

      What is the rules?

    • #35641
      WCFM Forum
      Keymaster

      Hi,

      It’s very easy, but don’t worry I will give you sample code for this tomorrow morning.

      Thank You

    • #35642
      vinnycampos
      Participant

      Thank you

    • #35691
      vinnycampos
      Participant

      Please send me step by step how to do, It will help me a lot!

    • #35696
      WCFM Forum
      Keymaster

      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

    • #35697
      vinnycampos
      Participant

      What this code do?

    • #35703
      WCFM Forum
      Keymaster

      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

    • #35705
      vinnycampos
      Participant
      This reply has been marked as private.
    • #35709
      vinnycampos
      Participant

      Ok, I did, and it appear at Custom Setting, It’s possible to add ACF Fields??

    • #35710
      WCFM Forum
      Keymaster

      PFA, I have add code in file.

      Thank You

      Attachments:
      You must be logged in to view attached files.
    • #35713
      WCFM Forum
      Keymaster

      Hi,

      You may tweak this to fit with your ACF fields, use same meta names.

      Thank You

    • #35714
      vinnycampos
      Participant

      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.

    • #35765
      WCFM Forum
      Keymaster

      Hi,

      “Because I can’t find where add the rules to show there.”

      – What do you mean by “rules”?

      Thank You

Viewing 12 reply threads
  • The topic ‘Add ACF Field to Store Settings’ is closed to new replies.