Skip to content

Instantly share code, notes, and snippets.

View fervous's full-sized avatar

Anna fervous

View GitHub Profile
@fervous
fervous / functions.php
Created January 4, 2019 02:05
Remove Shipping tab from product form WC Vendors Pro
// Remove shipping tab on the product-edit form.
add_filter( 'wcv_product_meta_tabs', 'remove_shipping_tab' );
function remove_shipping_tab( $tabs ){
unset( $tabs['shipping'] );
return $tabs;
} // remove_shipping_tab()
@fervous
fervous / functions.php
Created December 19, 2018 03:17
remove / unset add product button pro vendor dashbaord wc vendors pro
/* WC Vendors Pro remove add product button pro vendor dashboard */
add_filter('wcv_dashboard_quick_links', 'remove_add_product' );
function remove_add_product( $quick_links ){
unset( $quick_links['product'] );
return $quick_links;
}
@fervous
fervous / functions.php
Created November 21, 2018 23:16
change seller info label wc vendors pro vendor settings page
/* change the label for the seller info wc vendors pro front end settings form */
add_filter('wcv_vendor_seller_info', 'custom_wcv_vendor_seller_info');
function custom_wcv_vendor_seller_info ( $args ){
$args['label'] = 'Profile & Policies';
return $args;
}
@fervous
fervous / functions.php
Last active November 14, 2018 02:09
add banking field to wc vendors pro settings page and admin user page
/* This should be placed in your theme/child theme functions.php.
Creates the function for the fields to collect the info, and adds the fields
to the front-end store settings page (payments tab) and the admin user page. */
/* ADD FIELD TO FRONT END DASHBOARD / SETTINGS */
add_action( 'wcvendors_settings_after_paypal', 'store_bank_details' );
function store_bank_details( ){
if ( class_exists( 'WCVendors_Pro' ) ){
$key = '_wcv_custom_settings_bankname';
$value = get_user_meta( get_current_user_id(), $key, true );
@fervous
fervous / functions.php
Created October 20, 2018 00:37
change nav navigation menu order pro dashboard wc vendors
// 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['product'] = $pages['product'];
$new_nav_order['dashboard_home'] = $pages['dashboard_home'];
$new_nav_order['order'] = $pages['order'];
$new_nav_order['rating'] = $pages['rating'];
$new_nav_order['shop_coupon'] = $pages['shop_coupon'];
$new_nav_order['settings'] = $pages['settings'];
@fervous
fervous / functions.php
Last active September 28, 2018 00:32
remove add to cart if vacation mode is active - wc vendors pro
//remove add to cart on product page if vacation mode is active
function IsVacation_product_page(){
$vendor_id = get_the_author_meta('ID');
$vacation_mode = get_user_meta( $vendor_id, '_wcv_vacation_mode', true );
if ($vacation_mode){
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
}
}
add_action('woocommerce_single_product_summary','IsVacation_product_page');
@fervous
fervous / functions.php
Created August 20, 2017 03:38
Add Vendor Address email and Info to Customer emails and Order Confirmation WC Vendors
add_action( 'woocommerce_add_order_item_meta', 'bwd_add_vendor_to_order_item_meta', 10, 2);
function bwd_add_vendor_to_order_item_meta( $item_id, $cart_item) {
$vendor_id = $cart_item[ 'data' ]->post->post_author;
// build up address
$address1 = get_user_meta( $vendor_id , '_wcv_store_address1', true );
$address2 = get_user_meta( $vendor_id , '_wcv_store_address2', true );
$city = get_user_meta( $vendor_id , '_wcv_store_city', true );
$store_postcode = get_user_meta( $vendor_id , '_wcv_store_postcode', true );
$address = ( $address1 != '') ? $address1 .', ' . $city .', '. $store_postcode :'';
@fervous
fervous / functions.php
Created September 19, 2018 02:24
WC Vendors default manage stock, one-of-a-kind / only one in stock, sold out on purchase
// Default value for manage stock? = yes
add_filter( 'wcv_product_manage_stock', 'change_default_manage_stock' );
function change_default_manage_stock() {
$field['post_id'] = $post_id;
$field['id'] = '_manage_stock';
$field['wrapper_class'] = 'show_if_simple show_if_variable';
$field['label'] = __( 'Manage stock?', 'wcvendors-pro' );
$field['description'] = __( 'Enable stock management at product level', 'wcvendors-pro' );
@fervous
fervous / functions.php
Created August 23, 2018 03:02
wc vendors pro default product type auction simple auction
/* WC Vendors Pro - changes default product type to Auction (simple auction plugin needed).
To be placed in the child theme functions.php */
add_filter( 'wcv_default_product_type', 'wcv_default_product_type_auction' );
function wcv_default_product_type_auction($product_type) {
$product_type = 'auction';
return $product_type;
}
@fervous
fervous / functions.php
Created August 2, 2018 20:24
remove hide store tab from vendor dashboard settings page
/* WC Vendors Pro remove store tab on settings page */
add_filter('wcv_store_tabs', 'remove_store_tab' );
function remove_store_tab( $store_tabs ){
unset( $store_tabs['store'] );
return $store_tabs;
}