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 October 19, 2016 03:01
SEO WC Vendors Overwrite meta description for vendor pages - Yoast
// SEO 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 );
@fervous
fervous / functions.php
Created April 7, 2017 01:01
enable manage stock by default wc vendors pro
/* Default value for manage stock = checked */
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 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
Last active February 11, 2021 13:00
Add Vendor Address and Info to Customer emails 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
Last active May 29, 2020 19:26
Add a new quicklink quick link to dashboard wc vendors pro
/* adds a a new quicklink to pro vendor dashboard */
add_filter('wcv_dashboard_quick_links', 'new_wcv_dashboard_quick_link');
function new_wcv_dashboard_quick_link($quick_links ){
$quick_links[] = array( 'label' => 'Name of Link Here', 'url' => 'http://test.dev/my-account' );
return $quick_links;
}
@fervous
fervous / functions.php
Last active February 4, 2020 21:24
change title required max length and message wc vendors pro product add edit form
/* WC Vendors Pro Change title Length Req. on Product Page */
add_filter('wcv_product_title', 'wcv_product_title_req');
function wcv_product_title_req( $args ){
$args['custom_attributes']['data-rules'] = 'required|max_length[200]';
return $args;
}
/* WC Vendors Pro Change title Length Req. Message on Product Page */
add_filter('wcv_product_title', 'wcv_product_title_req_error');
function wcv_product_title_req_error( $args ){
@fervous
fervous / functions.php
Created May 2, 2018 21:57
wc vendors woocommerce bookings commission fee per person
add_filter( 'wcv_commission_rate', 'my_wcv_commission_rate', 10, 4 );
function my_wcv_commission_rate( $commission, $product_id, $product_price, $order ) {
$product = wc_get_product($product_id);
$commission_amount = get_post_meta( $product_id, 'wcv_commission_amount', true );
$items = $order->get_items();
foreach( $items as $item ) {
$booking_ids = WC_Booking_Data_Store::get_booking_ids_from_order_item_id( $item->get_id() );
foreach( $booking_ids as $booking_id ) {
$booking = new WC_Booking($booking_id);
@fervous
fervous / functions.php
Created September 27, 2017 15:23
change apply to become a vendor checkbox text my-account page my account wc vendors
/* add this to your child theme functions.php */
add_filter ('wcvendors_vendor_registration_checkbox', 'custom_wcvendors_vendor_registration_checkbox');
function custom_wcvendors_vendor_registration_checkbox () {
$message = 'new apply text here';
return $message;
}
@fervous
fervous / functions.php
Last active April 18, 2019 01:36
wc vendors pro new add a custom text field for message on product page
function add_custom_info_field() {
WCVendors_Pro_Form_Helper::input ( array(
'id' => 'custom_info_message',
'placeholder' => __( 'add a message ...'),
'value' => $value
)
);
}
add_action( 'woocommerce_after_add_to_cart_button', 'add_custom_info_field' );
@fervous
fervous / product-download.php
Created January 9, 2019 03:56
stock fields added to product-download.php
<?php
/**
* The template for displaying the Downloadable Product Edit form
*
* Override this template by copying it to yourtheme/wc-vendors/dashboard/
*
* @package WCVendors_Pro
* @version 1.5.5
*/
/**