This file contains hidden or 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 | |
// Add R xx.xx per KG | |
add_action( 'woocommerce_price_html', 'wc_custom_price', 10, 2 ); | |
function wc_custom_price( $price, $product ) { | |
return sprintf( __( '%s per KG', 'woocommerce' ), woocommerce_price( $product->get_price() ) ); | |
} | |
?> |
This file contains hidden or 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 | |
add_filter( 'init', 'wc_tax_exempt_user_roles' ); | |
function wc_tax_exempt_user_roles() { | |
if ( ! is_admin() ) { | |
global $woocommerce; | |
if ( current_user_can('wholesaler') || current_user_can('distributor') ) { | |
$woocommerce->customer->set_is_vat_exempt(true); | |
} else { | |
$woocommerce->customer->set_is_vat_exempt(false); | |
} |
This file contains hidden or 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
// Overwrite meta description for vendor pages | |
function overwrite_vendor_meta($desc) { | |
// Return the default value if we're not on a vendor shop page | |
if(!WCV_Vendors::is_vendor_page()) return $desc; | |
// Get the vendor description and return it | |
$vendor_shop = urldecode( get_query_var( 'vendor_shop' ) ); | |
$vendor_id = WCV_Vendors::get_vendor_id( $vendor_shop ); | |
$desc = get_user_meta( $vendor_id, 'pv_shop_description', true ); |
This file contains hidden or 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 | |
// Change the "Add Product" button url to the back end. | |
add_filter('wcv_add_product_url', 'new_add_product_url'); | |
function new_add_product_url(){ | |
return admin_url('post-new.php?post_type=product'); | |
} | |
?> |
This file contains hidden or 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 | |
// This code goes in the product-edit.php override template for wc-vendors pro | |
// Replace WCVendors_Pro_Product_Form::description( $object_id, $product_description ); | |
// with | |
$product_description_args = array( | |
'editor_height' => 200, | |
'media_buttons' => true, | |
'teeny' => true, |
This file contains hidden or 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 | |
add_filter('wcv_dashboard_start_date', 'dashboard_start_date' ); | |
function dashboard_start_date() { | |
return '-1 week'; | |
} | |
This file contains hidden or 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 | |
// Change the start date | |
// from 1 year ago to 1 week ago | |
add_filter('wcv_dashboard_start_date', 'dashboard_start_date' ); | |
function dashboard_start_date() { | |
return '-1 week'; | |
} | |
// Change the end date |
This file contains hidden or 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 | |
// Put this in your themes functions.php | |
// Remove all existing actions and filters | |
remove_action( 'woocommerce_after_shop_loop_item', array( 'WCV_Vendor_Shop', 'template_loop_sold_by'), 9, 2); | |
remove_filter( 'woocommerce_get_item_data', array( 'WCV_Vendor_Cart', 'sold_by' ), 10, 2 ); | |
remove_action( 'woocommerce_product_meta_start', array( 'WCV_Vendor_Cart', 'sold_by_meta' ), 10, 2 ); | |
remove_filter( 'woocommerce_order_product_title', array( 'WCV_Emails', 'show_vendor_in_email' ), 10, 2 ); | |
remove_action( 'woocommerce_add_order_item_meta', array( 'WCV_Vendor_Shop', 'add_vendor_to_order_item_meta'), 10, 2 ); | |
remove_action( 'woocommerce_after_shop_loop_item', array( $wcvendors_pro->wcvendors_pro_store_controller, 'loop_sold_by' ), 8 ); |
This file contains hidden or 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
This code adds a custom field to the Dashboard > Settings page for your vendors to | |
provide you extra bits of info you may need from them. Duplicate for each custom field you need, | |
renaming the meta keys and functions each time so they are not duplicated. | |
Part #1 - Theme functions.php file: | |
/* WC Vendors Pro - My Custom Field */ | |
function store_bank_details( ){ | |
if ( class_exists( 'WCVendors_Pro' ) ){ | |
$key = '_wcv_custom_settings_bankname'; |
This file contains hidden or 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
// Place this in your themes functions.php | |
// This will put the menu item in your primary menu. Change the theme location if you want to change which menu this goes in. | |
// Use the Free code for WC Vendors Free, use the Pro code for WC Vendors Pro | |
/* BEGIN WC Vendors Free */ | |
add_filter( 'wp_nav_menu_items', 'wcv_vendors_menu', 10, 2 ); | |
function wcv_vendors_menu ( $items, $args ) { | |
if ($args->theme_location == 'primary') { | |
$vendors = get_users( array( 'role' => 'vendor' ) ); | |
$items .= '<li><a href="#">Vendors</a>'; |
OlderNewer