Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Marketplace (WooCommerce Multivendor Marketplace) › How to show store info & banner on single product page?
- This topic has 1 reply, 2 voices, and was last updated 4 years, 6 months ago by Sushobhan.
- AuthorPosts
- November 15, 2019 at 8:01 pm #92465hahaha1132000Participant
Hi guys, would like to know how we add shortcode to single product page? I tried using code below but nothing appear
add_action( ‘woocommerce_before_single_product’, ‘wc_print_storeinfo’, 10 );
function wc_print_storeinfo() {
echo do_shortcode( ‘[wcfm_store_info id=”” data=””]’ );
}
Please help for this, thanksAttachments:
You must be logged in to view attached files. - November 19, 2019 at 2:21 pm #92933SushobhanKeymaster
Hello,
The code you are using is fine. All you need is to specify attributes of the shortcode, id and data. Now as per the documentation if you use this shortcode in store sidebar then it will automatically get current store id and you may just leave this parameter, which is not the case here. You are using this in single product page. So here you need to specify the vendor id. In data attribute you can use any of the following types –
store_name, store_url, store_address, store_email, store_phone, store_gravatar, store_banner, store_support, store_social, store_location, store_ratingTake a look at the modified code snippet-
add_action( 'woocommerce_before_single_product', 'wc_print_storeinfo', 10 ); function wc_print_storeinfo() { global $product, $WCFM; $id = $product->get_id(); $vendor_id = $WCFM->wcfm_vendor_support->wcfm_get_vendor_id_from_product( $id ); echo do_shortcode( "[wcfm_store_info id='".$vendor_id."' data='store_email']" ); }
Thanks
- AuthorPosts
- The topic ‘How to show store info & banner on single product page?’ is closed to new replies.