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 February 11, 2018 03:11
wc vendors pro remove all international shipping and no national shipping checkbox
/*Remove International Shipping Charge Field */
add_filter( 'wcv_shipping_international_fee', 'hide_wcv_shipping_international_fee' );
function hide_wcv_shipping_international_fee( $field ) {
$field['label'] = __( '' );
$field['description'] = __( '' );
$field['type'] = 'hidden';
$field['value'] = 'no';
return $field;
}
@fervous
fervous / functions.php
Created January 31, 2018 21:25
product type change labels wc vendors pro rename
/* WC Vendors Pro Rename Product Types */
/* Simple change to Classified */
add_filter('wcv_product_type_selector', 'wcv_product_type_selector_rename');
function wcv_product_type_selector_rename( $product_type_selector ){
if ( array_key_exists('simple', $product_type_selector ) ) $product_type_selector[ 'simple' ]= 'Classified';
return $product_type_selector;
}
/* External Change to My Website */
add_filter('wcv_product_type_selector', 'wcv_product_type_selector_rename_external');
@fervous
fervous / functions.php
Created January 27, 2018 02:50
translate strings WC Vendors Pro
/* store and stores to table and tables */
add_filter( 'gettext', 'wcv_translate_store', 999 );
function wcv_translate_store( $translated ) {
$translated = str_ireplace( 'Store', 'Table', $translated );
return $translated;
}
add_filter( 'gettext', 'wcv_translate_stores', 999 );
@fervous
fervous / functions.php
Created January 12, 2018 16:05
change rename label return policy wc vendors pro
/* Rename Return Policy Label - put this in the child theme functions.php file */
add_filter('wcv_vendor_shipping_return_policy', 'custom_wcv_vendor_shipping_return_policy');
function custom_wcv_vendor_shipping_return_policy( $args ){
$args['label'] = 'Return Policy & Terms';
return $args;
}
@fervous
fervous / functions.php
Created December 19, 2017 04:59
wc vendors pro add vendor sold by to seller info tab product page
/* sold by product page - seller info tab */
add_action('wcv_before_seller_info_tab', 'sold_by_seller_tab');
function sold_by_seller_tab() {
$vendor_shop = urldecode( get_query_var( 'vendor_shop' ) );
$vendor_id = get_the_author_meta('ID');
$store_url = WCVendors_Pro_Vendor_Controller::get_vendor_store_url( $vendor_id );
$shop_name = get_user_meta( $vendor_id, 'pv_shop_name', true );
$sold_by = '<a href="'.$store_url.'">'.$shop_name.'</a>';
echo '<p>Sold By: '.$sold_by.'</p>';
}
@fervous
fervous / class-wcv-simple-auctions.php
Created December 18, 2017 15:30
wc vendors pro simple auctions edit timepicker
WCVendors_Pro_Form_Helper::input( apply_filters( 'wcv_simple_auctions_start_date', array(
'post_id' => $post_id,
'id' => '_auction_dates_from',
'label' => __( 'From', 'wcvendors-pro-simple-auctions' ),
'class' => 'wcv-datetimepicker',
'placeholder' => __( 'From&hellip;', 'placeholder', 'wcvendors-pro-simple-auctions' ). ' YYYY-MM-DD HH:MM',
'wrapper_start' => '<div class="wcv-cols-group wcv-horizontal-gutters"><div class="all-50 small-100 ">',
'wrapper_end' => '</div>',
'custom_attributes' => array(
@fervous
fervous / functions.php
Created December 11, 2017 20:46
wc vendors pro website url required field
/* WEBSITE REQUIRED */
function wcv_vendor_company_url_required( $args ) {
$args[ 'custom_attributes' ] = array(
'data-rules' => 'required',
'data-error' => __( 'This field is required.', 'wcvendors-pro' )
);
return $args;
}
add_filter( 'wcv_vendor_company_url', 'wcv_vendor_company_url_required' );
/* WC Vendors Pro - My Custom Field */
add_action( 'wcvendors_settings_after_shop_description', 'store_bank_details', 9,2 );
function store_bank_details( ){
if ( class_exists( 'WCVendors_Pro' ) ){
$key = '_wcv_custom_settings_bankname';
$value = get_user_meta( get_current_user_id(), $key, true );
// Bank Name
WCVendors_Pro_Form_Helper::input( array(
'id' => $key,
'label' => __( 'Total Staff Members', 'wcvendors-pro' ),
@fervous
fervous / functions.php
Created November 18, 2017 17:10
relocate remove move product ships from wc vendors pro
/* remove from product meta start */
remove_action ( 'woocommerce_product_meta_start', array($wcvendors_pro->wcvendors_pro_vendor_controller, 'product_ships_from'), 9 );
/* Add elsewhere (use the hook you wish) */
add_action ( 'woocommerce_before_add_to_cart_form', array($wcvendors_pro->wcvendors_pro_vendor_controller, 'product_ships_from'));
/* this would go in your child theme functions.php: */
function custom_shipping_message () {
$message = 'your message here';
echo '<p>'.$message.'</p>';
}
/* this would go where you wish the message to show up in your product-edit.php
template which you have copied and moved to your child theme
(wp-content/themes/your-child-theme/wc-vendors/dashbaord/product-edit.php): */