• Hello,

    I would like to add custom fields on the store page, for example add a link to a video, an extra image or a text block. I would like it to appear in the store editor and on each store page. How it works in products. I have ACF installed in case it can be of help.

    Thanks!

    • This topic was modified 4 years, 2 months ago by Ardit.
Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter Ardit

    (@gerardbr)

    Help me

    Plugin Author WC Lovers

    (@wclovers)

    I will provide you a snippet for this.

    Thread Starter Ardit

    (@gerardbr)

    Perfect, how do we do it?

    Plugin Author WC Lovers

    (@wclovers)

    Here is a sample snippet to add “website” field under vendor setting and store header –

    add_action( 'end_wcfm_vendor_settings', function( $vendor_id ) {
    	global $WCFM;
    	$wcfm_vendor_website = get_user_meta( $vendor_id, 'wcfm_vendor_website', true );	
    	?>                                
    	<!-- collapsible -->
    	<div class="page_collapsible" id="wcfm_settings_form_additional_head">
    		<label class="fa fa-certificate"></label>
    		<?php _e('Additional Info', 'wc-multivendor-marketplace'); ?><span></span>
    	</div>
    	<div class="wcfm-container">
    		<div id="wcfm_settings_form_additional_expander" class="wcfm-content">
    			<h2><?php _e('Additional Setting', 'wc-multivendor-marketplace'); ?></h2>
    			<div class="wcfm_clearfix"></div>
    			<?php
    				$WCFM->wcfm_fields->wcfm_generate_form_field( array(
    																														"wcfm_vendor_website" => array( 'label' => __( 'Website', 'wc-multivendor-marketplace'), 'name' => 'wcfm_vendor_website', 'type' => 'text', 'class' => 'wcfm-text wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele', 'value' => $wcfm_vendor_website ),
    																													 ) );
    			?>
    		</div>
    	</div>
    	<!-- end collapsible -->
    	<?php
    }, 50, 1 );
    add_action( 'wcfm_vendor_settings_update', function( $vendor_id, $wcfm_settings_form ) {
    	global $WCFM, $_POST;
    	if( isset( $wcfm_settings_form['wcfm_vendor_website'] ) ) {
    		update_user_meta( $vendor_id, 'wcfm_vendor_website', $wcfm_settings_form['wcfm_vendor_website'] );
    	}
    }, 50, 2 );
    add_action( 'wcfmmp_store_list_after_store_info', function( $vendor_id, $store_info ) {
    	global $WCFM;
    	$site_url = get_user_meta( $vendor_id, 'wcfm_vendor_website', true );
      if( $site_url ) {
        $site_url_href = $site_url;
    	  if (strpos( $site_url_href, 'http') === false) {
    	  	$site_url_href = "https://" . $site_url_href;
    	  }
    		?>
    		<p class="store-phone">
    			<i class="wcfmfa fa-globe" aria-hidden="true"></i>
    			&nbsp;<a href="<?php echo $site_url_href; ?>"><?php echo $site_url; ?></a>
    		</p>
    		<?php
    	}
    }, 10, 2 );
    add_action( 'after_wcfmmp_store_header_info', function( $vendor_id ) {
    	global $WCFM;
    	$site_url = get_user_meta( $vendor_id, 'wcfm_vendor_website', true );
      if( $site_url ) {
        $site_url_href = $site_url;
    	  if (strpos( $site_url_href, 'http') === false) {
    	  	$site_url_href = "https://" . $site_url_href;
    	  }
    		?>
    		<div class="store_info_parallal">
    			<i class="wcfmfa fa-globe" aria-hidden="true"></i>
    			<span>
    				<a href="<?php echo $site_url_href; ?>"><?php echo $site_url; ?></a>
    			</span>
    		</div>
    		<div class="spacer"></div>  
    		<?php
    	}
    }, 10 );
    Thread Starter Ardit

    (@gerardbr)

    Well, it appears in the editor of the store! but I need it to appear in the store page created with Elementor, do I have to insert a shortcode?

    What I’m really interested in is being able to add an embedded Youtube video and an image.

    Thank you

    Plugin Author WC Lovers

    (@wclovers)

    Sure, you may show this using shortcode as well.

    For this sample field shortcode will be – [wcfm_store_info data="wcfm_vendor_website"]

    You may create your own field as well. Just use this “meta key” as data for the shortcode attribute – https://ibb.co/BV0NLgL

    Thread Starter Ardit

    (@gerardbr)

    Perfect! now with this shortcode it appears on the store page. But it does not appear in the manager’s store editor. It only appears in the seller’s editor. it’s possible?

    Thank you ??

    Plugin Author WC Lovers

    (@wclovers)

    But it does not appear in the manager’s store editor. It only appears in the seller’s editor. it’s possible?

    – DO you want to edit this field as Admin from vendor manager page?

    Thread Starter Ardit

    (@gerardbr)

    Yes! I want it to appear in both Admin and Vendor. sorry for the translation.

    Plugin Author WC Lovers

    (@wclovers)

    NO issues, add this snippet as well –

    add_filter( 'wcfm_marketplace_settings_fields_general', function( $setting_fields, $vendor_id ) {
    	if( !wcfm_is_vendor() ) {
    		$wcfm_vendor_website     = get_user_meta( $vendor_id, 'wcfm_vendor_website', true );
    		$wcfm_vendor_website_field = array(
    																				"wcfm_vendor_website" => array( 'label' => __( 'Website', 'wc-multivendor-marketplace'), 'name' => 'wcfm_vendor_website', 'type' => 'text', 'class' => 'wcfm-text wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele', 'value' => $wcfm_vendor_website ),
    																			 );
    		$setting_fields = array_merge( $wcfm_vendor_website_field, $setting_fields );
    	}
    	return $setting_fields;
    }, 50, 2 );

    Admin can manage this from vendor manager – store setting – https://ibb.co/Jmz89NW

    Thread Starter Ardit

    (@gerardbr)

    Amazing, I’m going to purchase the Ultimate plugin. I understand that I will have a personalized support to solve my doubts about the embedding of YouTube and other issues, right?

    Thank you!

    Plugin Author WC Lovers

    (@wclovers)

    Sure, our premium support team will help you on those.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Custom fields on the store page’ is closed to new replies.