Add Custom Fields on Vendor Store "Home"

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 WC Vendors Add Custom Fields on Vendor Store "Home"

Viewing 3 reply threads
  • Author
    Posts
    • #66566
      thiemann.k
      Participant

      Hey Community,

      I would like to let sellers create their own terms and conditions and their own imprint.

      In the dashboard under “Policies Setting” so far, information can be provided on “Shipping Policy”, “Exchange Policy” and “Cancellation / Exchange / Return Policy”. https://ibb.co/jTnmv4N

      I would like to extend this to the two fields: “Terms” and “Imprint”.

      In the shop view under “https: // your-domain / store / vendor-store / policies /” there is the tab “Policies”.
      Here you should then please the previously added fields are displayed.

      Definitely with a snippet to solve.

      Thank you!!!

    • #67019
      WCFM Forum
      Keymaster

      HI,

      Please add this code to your child theme’s functions.php –

      add_filter( 'wcfm_vendor_settings_fields_policies', function( $policy_fields, $vendor_id ) {
      	$_wcfm_vendor_payment_policy = wcfm_get_user_meta( $vendor_id, 'wcfm_vendor_payment_policy', true );
      	$rich_editor = apply_filters( 'wcfm_is_allow_rich_editor', 'rich_editor' );
      	$wpeditor = apply_filters( 'wcfm_is_allow_product_wpeditor', 'wpeditor' );
      	if( $wpeditor && $rich_editor ) {
      		$rich_editor = 'wcfm_wpeditor';
      	} else {
      		$wpeditor = 'textarea';
      	}
      	$policy_fields['payment_policy'] = array('label' => __('Terms and Imprint', 'wc-frontend-manager'), 'type' => $wpeditor, 'class' => 'wcfm-textarea wcfm_ele wcfm_full_ele wcfm_custom_field_editor ' . $rich_editor, 'label_class' => 'wcfm_title wcfm_full_title', 'value' => $_wcfm_vendor_payment_policy );
      	return $policy_fields;
      }, 50, 2 );
      add_action( 'wcfm_vendor_settings_update', function( $vendor_id, $wcfm_settings_form ) {
      	if( isset( $wcfm_settings_form['payment_policy'] ) ) {
      		wcfm_update_user_meta( $vendor_id, 'wcfm_vendor_payment_policy', $wcfm_settings_form['payment_policy'] );
      	}	
      }, 20, 2 );
      
      add_action( 'wcfmmp_store_after_policies', function( $vendor_id ) {
      	$_wcfm_vendor_payment_policy = wcfm_get_user_meta( $vendor_id, 'wcfm_vendor_payment_policy', true );
      	if( !wcfm_empty( $_wcfm_vendor_payment_policy ) ) { ?>
      		<div class="policies_area wcfm-payment-policies">
      			<h2 class="wcfm_policies_heading"><?php echo apply_filters('wcfm_payment_policies_heading', __('Terms and Imprint', 'wc-frontend-manager')); ?></h2>
      			<div class="wcfm_policies_description" ><?php echo $_wcfm_vendor_payment_policy; ?></div>
      		</div>
      	<?php }
      }, 50 );
      
      add_action( 'wcfm_policy_content_after', function( $product_id ) {
      	global $WCFM;
      	$vendor_id = $WCFM->wcfm_vendor_support->wcfm_get_vendor_id_from_product( $product_id );
      	if( $vendor_id ) {
      		$_wcfm_vendor_payment_policy = wcfm_get_user_meta( $vendor_id, 'wcfm_vendor_payment_policy', true );
      		if( !wcfm_empty( $_wcfm_vendor_payment_policy ) ) {
      			?>
      			<div class="wcfm-payment-policies">
      				<h2 class="wcfm_policies_heading"><?php echo apply_filters('wcfm_payment_policies_heading', __('Terms and Imprint', 'wc-frontend-manager')); ?></h2>
      				<div class="wcfm_policies_description" ><?php echo $_wcfm_vendor_payment_policy; ?></div>
      			</div>
      			<?php
      		}
      	}
      }, 50 );
      
      add_action( 'wcfm_order_details_policy_content_after', function( $vendor_id ) {
      	$_wcfm_vendor_payment_policy = wcfm_get_user_meta( $vendor_id, 'wcfm_vendor_payment_policy', true );
      	if( !wcfm_empty( $_wcfm_vendor_payment_policy ) ) {
      		?>
      		<tr>
      			<th colspan="3" style="background-color: #eeeeee;padding: 1em 1.41575em;line-height: 1.5;"><strong><?php echo apply_filters('wcfm_payment_policies_heading', __('Terms and Imprint', 'wc-frontend-manager')); ?></strong></th>
      			<td colspan="5" style="background-color: #f8f8f8;padding: 1em;"><?php echo $_wcfm_vendor_payment_policy; ?></td>
      	  </tr>
      		<?php
      	}
      }, 50 );
      
      add_action( 'wcfm_store_invoice_policy_content_after', function( $product_id ) {
      	global $WCFM;
      	$vendor_id = $WCFM->wcfm_vendor_support->wcfm_get_vendor_id_from_product( $product_id );
      	if( $vendor_id ) {
      		$_wcfm_vendor_payment_policy = wcfm_get_user_meta( $vendor_id, 'wcfm_vendor_payment_policy', true );
      		if( !wcfm_empty( $_wcfm_vendor_payment_policy ) ) {
      			?>
      			<tr>
      				<th colspan="3" style="background-color: #eeeeee;padding: 1em 1.41575em;line-height: 1.5;"><?php echo apply_filters('wcfm_payment_policies_heading', __('Terms and Imprint', 'wc-frontend-manager')); ?></th>
      				<td colspan="5" style="background-color: #f8f8f8;padding: 1em;"><?php echo $_wcfm_vendor_payment_policy; ?></td>
      			</tr>
      			<?php
      		}
      	}
      }, 50 );

      Thank You

    • #67113
      thiemann.k
      Participant

      Wow! just great!!! …it looks so easy….. Thank you!!!

    • #67120
      WCFM Forum
      Keymaster

      My pleasure ­čÖé

Viewing 3 reply threads
  • You must be logged in to reply to this topic.
    Glastrennw├Ąnde
    blumen verschicken Blumenversand
    blumen verschicken Blumenversand
    Reinigungsservice Reinigungsservice Berlin
    k├╝chenrenovierung k├╝chenfronten renovieren k├╝chenfront erneuern