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 | |
/** | |
* This code will disable add product functionality until the stripe connected account is active for the vendor. This will also disable quick links on the main dashboard page. | |
* | |
*/ | |
// Only enable if the Stripe gateway is actually active | |
if ( class_exists('WC_Gateway_Stripe_Connect') ) { | |
// Hook into the dashboard |
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 | |
// Add this to your themes functions.php to change the order, rearrage the lines. First line is first item, last is last etc. | |
add_filter( 'wcv_dashboard_pages_nav', 'change_nav_order'); | |
function change_nav_order( $pages ){ | |
$new_nav_order = array(); | |
$new_nav_order['dashboard_home'] = $pages['dashboard_home']; |
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
// 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 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
//WP Query to get all bookable products of a vendor | |
$args = array( | |
'post_type' => 'product', | |
'author' => $vendor, | |
'meta_query' => array( | |
array( | |
'key' => '_wc_booking_availability', | |
'compare' => 'EXISTS', | |
), |
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
/* By default Registrations to your site using the My Account = Vendor role, rather than the Customer role */ | |
add_filter( 'woocommerce_new_customer_data', 'custom_woocommerce_new_customer_data' ); | |
function custom_woocommerce_new_customer_data( $data ){ | |
$data['role'] = 'vendor'; // the new default role | |
return $data; | |
} |
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 | |
// Remove the Vendor shop name from the shipping package title | |
add_filter( 'wcv_vendor_shipping_package_title', 'remove_shipping_title' ); | |
function remove_shipping_title( $title ){ | |
return ''; | |
} | |
?> |
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 | |
// 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 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_commission_rate', 'my_wcv_commission_rate', 10, 4 ); | |
function my_wcv_commission_rate( $commission, $product_id, $product_price, $order ) { | |
$terms = get_the_terms( $product_id, 'product_cat' ); | |
// Loop through the categories | |
// It will break on the first category assigned | |
foreach ( $terms as $term ) { |
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 | |
// Put this in your themes functions.php | |
add_filter( 'wcv_product_title', 'product_title_date' ); | |
function product_title_date( $args ){ | |
$args[ 'class' ] = 'wcv-datepicker'; | |
return $args; | |
} |
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 | |
// Add this to your themes functions.php this will not work with free only the pro dashboard. | |
add_action( 'wcv_pro_before_dashboard', 'add_stripe_notice' ); | |
function add_stripe_notice( ){ | |
$stripe_token = get_user_meta( get_current_user_id(), '_stripe_connect_access_key' , true ); | |
if ( ! isset( $stripe_token ) ){ | |
echo '<div class="woocommerce-error"><p>Connect your stripe account to accept payments thanks!</p></div>'; | |
} |
NewerOlder