Display Product vendors name
Viewing 6 Posts - 1 through 6 (of 6 total)
Author | Posts |
---|---|
June 10, 2015 at 9:46 pm 51721 | |
towhid | Hi! I want to display the vendors name alongside the Product name and price in the shop page (the thumbnails of products). I found this (pasted below) from woocommerce but i’m guessing the tag for vendors is wrong. Could you help? /** * Print the product’s vendor name before the product title in the loop. * * @return void */ function wc_vendors_name_loop() { $vendors = get_the_terms( get_the_ID(), ‘shop_vendor’ ); if ( $vendors && ! is_wp_error( $vendors ) ) { foreach ( $vendors as $vendor ) { $all_vendors[] = $vendor->name; } $vendors = join( “, “, $all_vendors ); echo ‘‘ . $vendors . ‘‘; } } add_action( ‘woocommerce_before_shop_loop_item_title’, ‘wc_vendors_name_loop’, 20 ); |
June 11, 2015 at 5:13 pm 51781 | |
towhid | Hello Anna, Did you try above code? Did you get any error? Can you please let me know the name of the theme you are using for your site now Thanks |
June 11, 2015 at 5:37 pm 51784 | |
Anna | Hi! I tried it and i got no error. I’m using the dokan theme 🙂 |
June 11, 2015 at 6:10 pm 51794 | |
towhid | Hello Anna, I need to test this code for me. Please allow me some time. Thanks |
June 13, 2015 at 5:58 pm 51997 | |
towhid | Hello Anna, Please navigate to `plugins/woocommerce/templates/single-product/content-product.php and this line After that line paste below code.
Thanks |
June 22, 2015 at 8:18 pm 52725 | |
Anna | Thanks, that worked like a charm! 🙂 Is there a way to get the Vendor name to link to their shop as well? Thanks! |
June 23, 2015 at 12:48 pm 52796 | |
towhid | Hello Anna, Then, you have to try this following code instead of the previous code which I have given to you.
Please let me know the result when done Thanks |
Viewing 6 Posts - 1 through 6 (of 6 total)