Display vendors products

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 5 reply threads
  • Author
    Posts
    • #106555
      ashley.younguk
      Participant

      Hello,

      I am building the single product page template using elementor and wcfm shortcodes to display things such as the store name etc… However I would like to display a section at the bottom of the vendors other products. How would I do this? Is there a shortcode similar to [wcfm_store_info id=”” data=””]?

      Thanks for your help

    • #106640

      Hi,

      Yeah sure, you may use this short code – [products store=""]

      Add vendor id at store=”VENDOR ID”

      Well, “products” is WC core short code, you may check details here – https://docs.woocommerce.com/document/woocommerce-shortcodes/

      Thanks.

    • #106661
      ashley.younguk
      Participant

      But how do you display that dynamically?

      As I said I am building the single product page template that will be used for all products. When I use [wcfm_store_info id=”” data=”store_name”] for example and leave ID blank it dynamically pulls through the store name of the product you are viewing.

      If I do the same with [products store=""] and leave STORE blank it still displays all products which is not what I want.

      It would be great to have an elementor widget call vendor products for this purpose.

    • #106707

      Hi,

      how do you display that dynamically?
      >>Unfortunately by default we don’t have any shortcode like this.

      add_shortcode('wcfm_store_related_products','fn_wcfm_store_related_products');
      function fn_wcfm_store_related_products($attr) {
      	global $WCFM, $WCFMmp, $wp, $WCFM_Query, $post;		
      	$store_id = '';
      	if ( isset( $attr['id'] ) && !empty( $attr['id'] ) ) { $store_id = absint($attr['id']); }	
      	if (  wcfm_is_store_page() ) {
      		$wcfm_store_url = get_option( 'wcfm_store_url', 'store' );
      		$store_name = apply_filters( 'wcfmmp_store_query_var', get_query_var( $wcfm_store_url ) );
      		$store_id  = 0;
      		if ( !empty( $store_name ) ) {
      			$store_user = get_user_by( 'slug', $store_name );
      		}
      		$store_id   		= $store_user->ID;
      	}	
      	if( is_product() ) {
      		$store_id = $post->post_author;
      	}
      	if( !$store_id && is_single() && $post && is_object( $post ) && wcfm_is_vendor( $post->post_author ) ) {
      		$store_id = $post->post_author;
      	}
      	echo do_shortcode('[products store="'.$store_id.'"]');
      }

      Add this code to your child theme’s functions.php
      In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/

      And use this short code – [wcfm_store_related_products id=””]
      (id = ”VENDOR ID”)

      Thanks.

    • #106729
      ashley.younguk
      Participant

      Works perfectly – thank you 🙂

    • #106812

      You are always welcome 🙂

      Let me know if there’s anything else we can help you with.
      Can we ask for a favor? Would you mind taking a few minutes to review our plugin at https://wordpress.org/support/plugin/wc-multivendor-marketplace/reviews/ and let others know about your 5 Star experience with WCFM Marketplace. Also, follow us on Twitter https://twitter.com/wcfmmp for more exciting news, important updates, and irresistible offers.

Viewing 5 reply threads
  • The topic ‘Display vendors products’ is closed to new replies.