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/:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 ); |
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.
Leave a Reply