Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM › Display vendors products
- This topic has 5 replies, 2 voices, and was last updated 4 years, 9 months ago by Sarmistha Chakraborty.
- AuthorPosts
- February 10, 2020 at 11:24 pm #106555ashley.youngukParticipant
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
- February 11, 2020 at 12:08 pm #106640Sarmistha ChakrabortyMember
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.
- February 11, 2020 at 1:18 pm #106661ashley.youngukParticipant
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.
- February 11, 2020 at 5:17 pm #106707Sarmistha ChakrabortyMember
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.
- February 11, 2020 at 9:11 pm #106729ashley.youngukParticipant
Works perfectly – thank you 🙂
- February 12, 2020 at 1:14 pm #106812Sarmistha ChakrabortyMember
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.
- AuthorPosts
- The topic ‘Display vendors products’ is closed to new replies.