Home Forums WC Vendors Free Support Related products by vendor code

NOTICE: We've Moved to a Ticket System for Support

As of August 31, 2017 (12am EST) our support forums will be retired (read-only), and we will be moving to a support ticket system.  This will allow us to better organize and answer support requests, and provide a more personalized experience as we assist our customers.

For the time being, we will leave our forums open for reading and learning while we work on creating a more robust Knowledge Base for everyone to use.

If you are a WC Vendors Pro customer please open a support ticket here. 

If you are a WC Vendors user please open a support ticket on the Wordpress.org forums.

The information on this forum is outdated and in most instances no longer relevant. Please be sure to check our documentation for the most up to date information.


Thank you to all of our customers!


Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
  • #12631

    Hi Ben,

    Just before I make the sky fall down 🙂

    Thought I should prob run this through you first.


    Am I right in thinking your related products code in knowledge base would create all vendors products as related products on single product page?

    If so 🙂 Would I navigate to THIS FILE GOES IN /themes/YOURTHEME/woocommerce/single-product/related.php and either delete the whole code that is in related.php and replace with your related products by vendor code or add your code to the bottom of the code already in related.php?

    Just didn’t want to nuke my site dude 🙂 ha

    Thanks for your advice.


    WC Vendors Support

    Hi Paul!

    You’d never nuke your site — as long as you save a copy of the file you are editing first, right? 🙂 Always have a way to hit UNDO! 🙂

    That code does work correctly, I’ve used it on many sites! If you have any problems with it let me know, there’s only one “gotcha” and that is if your theme is overriding the woocommerce_related_products_args filter which is an easy fix anyhow.




    That’s great Ben thanks for the advice … great bit of code … I was going to linked products and adding one by one before 🙂

    Just to check do I Either …

    1, delete the whole code that is in related.php and replace with your related products by vendor code or:

    2, add your code to the bottom of the code already in related.php?

    Im thinking its 1 🙂

    Wow I surprise myself sometimes with my knowledge 🙂

    Thank you for your help



    Went for number 1 Ben …and it worked amazingly 🙂

    Is there a way to show all the vendors products or a certain amount would be super amazing!?

    Thank you.


    WC Vendors Support

    Yay. 🙂 So, for part #2, read the php file. What does it say for how many products to display? 🙂


    I did check first … but couldn’t see anything in the file … did manage to change wording to shop more: 🙂

    But checked 7 times and can’t see a way to change number of products to display.

    I did a find on products and 4 which is the amount currently shown but still couldn’t see a way.

    Maybe it was a trick question 🙂 🙂 but must be blind as cant see a way to change even though I could understand Mongolian language better than code 🙂

    Thanks for your continued help Ben 🙂

    * Related Products By Same Author
    * THIS FILE GOES IN /themes/YOURTHEME/woocommerce/single-product/related.php
    * @author WooThemes
    * @package WooCommerce/Templates
    * @version 1.6.4
    if ( ! defined( ‘ABSPATH’ ) ) exit; // Exit if accessed directly
    global $product, $woocommerce_loop;
    $artist = get_the_author_meta(‘ID’);
    //Get url to put in related products title
    $sold_by = WCV_Vendors::is_vendor( $artist )
    ? sprintf( ‘%s‘, WCV_Vendors::get_vendor_shop_page( $artist ), WCV_Vendors::get_vendor_sold_by( $artist ) )
    : get_bloginfo( ‘name’ );
    $args = apply_filters(‘woocommerce_related_products_args’, array(
    ‘post_type’ => ‘product’,
    ‘ignore_sticky_posts’ => 1,
    ‘no_found_rows’ => 1,
    ‘posts_per_page’ => $posts_per_page,
    ‘orderby’ => $orderby,
    ‘author’ => $artist,
    ‘post__not_in’ => array($product->id)
    ) );
    $products = new WP_Query( $args );
    $woocommerce_loop[‘columns’] = $columns;
    if ( $products->have_posts() ) : ?>

    <div class=”related products”>

    <?php echo apply_filters(‘wcvendors_cart_more_work_by’, __( ‘Shop More: ‘, ‘wcvendors’ )) . $sold_by . ‘<br/>’; ?>

    <?php woocommerce_product_loop_start(); ?>

    <?php while ( $products->have_posts() ) : $products->the_post(); ?>

    <?php woocommerce_get_template_part( ‘content’, ‘product’ ); ?>

    <?php endwhile; // end of the loop. ?>

    <?php woocommerce_product_loop_end(); ?>


    <?php endif;

    WC Vendors Support

    ‘posts_per_page’ => $posts_per_page,

    Maybe change $posts_per_page to 100000000? 🙂


    🙂 I did try before changing the $ for 10 or 20 and it corrupted the page. Was I correct in replacing the $ with numbers or should I have placed the numbers somewhere else?

    My product gallery images opened on a page on their own and the magnifier did not work … saw bits of pro from pro reviews etc.

    I’m getting closer 🙂


    Hi Ben,

    Finally sussed it out 🙂

    ‘posts_per_page’ => 70, $posts_per_page, Oh yeah! 🙂

    Hope you guys are working hard on variable products for us fashion folks etc who feel left out of all the fun 🙂

    WC Vendors Support

    Good man. 🙂 The more you play around with tweaking things the faster you learn! We’re working on the shipping aspect right now, and then variations comes next. 🙂


    Thank you ben… yes am learning little by little 🙂

    So looking forward to variations and pro 🙂

Viewing 11 posts - 1 through 11 (of 11 total)
  • The forum ‘WC Vendors Free Support’ is closed to new topics and replies.