Show a custom template for the vendor shop pages

Are you using the plugin WooCommerce Product Vendors?
Well, I think you will love this tutorial then!

If you are one of those users who want to setup a custom vendor shop page, add this code in your functions.php file located in wp-content/themes/your-theme-name/:


<?php
/**
* Load a custom template for vendor taxonomy
*/
function load_custom_vendor_template( $located, $template_name ) {
if( is_tax( WC_PRODUCT_VENDORS_TAXONOMY ) && 'archive-product.php' == $template_name ) {
return get_stylesheet_directory() . '/woocommerce/taxonomy-shop_vendor.php';
}
return $located;
}
add_filter( 'wc_get_template', 'load_custom_vendor_template', 10, 2 );

view raw

functions.php

hosted with ❤ by GitHub

Delete the <?php first line if you are having errors come up after saving the file.

Be sure to create a file named taxonomy-shop_vendor.php in your wp-content/themes/your-theme-name/woocommerce/ folder and edit it to match your desires.

For a basic configuration, I suggest to copy the template taxonomy-product_cat.php from the folder wp-content/plugins/woocommerce/templates/ and paste it in your theme WooCommerce folder. Then rename it and apply your changes.


More Posts That You Might Like…


18 responses to “Show a custom template for the vendor shop pages”

  1. Nice~!
    These seems to be for the Vendors but
    how can I create a page for the /vendor top page…? If I go to /vendor it just gives me 404, would nice to show all the vendors or something on that page.

    1. Hi Teo,
      cool idea!

      Actually this is not supported, but we are rewriting the plugin, so perhaps we could add something like this.

      If you’d like you could add this to our ideas board: https://ideas.woothemes.com – that way our developers know what solutions our customers need as they can be voted up and prioritized based on demand.

      Thanks!

  2. Ciao,
    ho fatto come indicato ma quando apro la pagina vendor mi appaiono i seguenti errori:

    Warning: include(/home4/alex/public_html/wp-content/themes/one-child/woocommerce/taxonomy-shop_vendor.php): failed to open stream: No such file or directory in /home4/alex/public_html/wp-content/plugins/woocommerce/includes/wc-core-functions.php on line 195

    Cosa sto sbagliando?

    Warning: include(): Failed opening ‘/home4/alex/public_html/wp-content/themes/one-child/woocommerce/taxonomy-shop_vendor.php’ for inclusion (include_path=’.:/opt/php54/lib/php’) in /home4/alex/public_html/wp-content/plugins/woocommerce/includes/wc-core-functions.php on line 195

    1. Ciao, non esiste il file taxonomy-shop_vendor.php nel tuo tema.

  3. ciao, grazie per la risposta veloce.
    ho capito di dover creare cartella woocommerce e file taxonomy-shop_vendor.php nel child-theme.. a quel punto si apriva una pagina bianca alla visione di una pagina vendor..
    quindi ho copiato il file taxonomy-product_cat.php e incollato nella cartella woocomerce col file taxonomy-shop_vendor.php.
    ancora pagina bianca.. quindi ho detto allora non era da copiare il file ma il contenuto del file.. ho copiato il contenuto di taxonomy-product_cat.php in taxonomy-shop_vendor.php ma aquesto punto ricevo una pagina errore 500 – internal server error…

    1. perso le speranze

  4. Hi,
    sounds great, but is this snippet still valid?
    I don’t get it to work, no changes to the vendor template; it still shows the standard layout.
    //Andreas

    1. Hi Andreas,
      I updated the code for the most recent version of Product Vendors!

      1. Thanks. Strange, does not work for me; no error message not any change on the layout.

  5. Dosnt seem to work anymore. It looks like the vendor logo and description are being added via a class hook and not a template, making the above code invalid.

    1. Exactly what I was having an issue with, however the above code does work, it’s just that the taxonomy has a different name, and the template file now needs to be named: taxonomy-wcpv_product_vendors.php

      Rename it, and update your function to match the new name, it’ll work 🙂

      1. This is working. Thanks man 🙂

      2. I need help with this. It didnt work for me. I keep getting errors.

      3. Thanks man! It works! Amazing! wow!

  6. It’s not working anymore. Really sade 🙁

    1. But maybe it will updated one day ?!

      1. Howdy,

        WooCommerce Product Vendors completely changed structure with version 2. Overwriting the template file will not work well any longer.

        The output now uses hooks via the function: `display_vendor_logo_profile()` located in `/includes/class-wc-product-vendors-vendor-frontend.php`.

        Kind regards,

  7. Hello Sir, Thanks for great blog, I am asking if there is any short code or php code to display a Vendors List in one page ?

Leave a Reply

Categories

Newsletter

Receive new articles from this blog directly in your inbox!

No spam guaranteed!

Blog at WordPress.com.

%d bloggers like this: