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 | |
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 | |
// 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 | |
// 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
// 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 | |
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
<?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() ) ); | |
} | |
?> |
NewerOlder