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 May 25, 2018 22:42
Remove WooCommerce Additional Details Tab
/* remove additional details tab from product page */
add_filter( 'woocommerce_product_tabs', 'custom_remove_product_tabs', 98 );
function custom_remove_product_tabs( $tabs ) {
unset( $tabs['additional_information'] );
return $tabs;
}
@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
Last active May 10, 2018 15:01
UPDATED add field to product add edit form; display value on product page wc vendors pro
/* add to your theme or child theme functions.php file to create a new field on the vendor add-edit product form */
add_action( 'wcv_product_options_general_product_data', 'wcv_custom_product_msrp_price_field' );
function wcv_custom_product_msrp_price_field ($post_id) {
WCVendors_Pro_Form_Helper::input( array(
'post_id' => $post_id,
'id' => '_wcv_custom_product_msrp_price',
'label' => __( 'MSRP Price', 'wcvendors-pro' ),
'placeholder' => __( 'MSRP Price', 'wcvendors-pro' ),
'desc_tip' => 'true',
'description' => __( 'Please specify MSRP Price', 'wcvendors-pro' ),
@fervous
fervous / functions.php
Created April 18, 2018 15:24
change price field label wc vendors pro product form
/* change the label for the price wc vendors pro front end add/edit product form */
add_filter('wcv_product_price', 'custom_wcv_product_price');
function custom_wcv_product_price ( $args ){
$args['label'] = '<strong>WHOLESALE PRICE</strong><br><i class="fa fa-info-circle" aria-hidden="true"></i> <small>Choose a price in USD $ <strong>WITHOUT</strong> currency symbols</small>';
return $args;
}
@fervous
fervous / functions.php
Created March 29, 2018 03:01
Disable Add Products in WC Vendors Pro if vendor hasn't connected stripe account
<?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
add_action( 'wcv_pro_before_dashboard', 'add_stripe_notice' );
function add_stripe_notice( ){
@fervous
fervous / functions.php
Created March 29, 2018 03:01 — forked from digitalchild/functions.php
Disable Add Products in WC Vendors Pro if vendor hasn't connected stripe account
<?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
@fervous
fervous / functions.php
Created March 29, 2018 00:07
wc vendors dashboard add product change quick link quicklinks label
/* change add product button / label */
add_filter('wcv_dashboard_quick_links', 'change_add_product');
function change_add_product( $quick_links ){
if ( array_key_exists('product', $quick_links ) ) $quick_links[ 'product' ][ 'label' ] = 'new label here';
return $quick_links;
}
@fervous
fervous / functions.php
Created March 28, 2018 03:21
translate vendor to seller wc vendors pro
/* change vendor to seller */
add_filter( 'gettext', 'wcv_translate_vendor', 999 );
function wcv_translate_vendor( $translated ) {
$translated = str_ireplace( 'vendor', 'seller', $translated );
return $translated;
}
@fervous
fervous / functions.php
Created March 18, 2018 23:50
change dashboard settings store address field labels and placeholders wc vendors pro
/* New City Label and Placeholder */
add_filter('wcv_vendor_store_city', 'custom_wcv_vendor_store_city');
function custom_wcv_vendor_store_city( $args ){
$args['label'] = 'New Label Here';
$args['placeholder'] = 'New Placeholder Here';
return $args;
}
/* New State Label and Placeholder */
add_filter('wcv_vendor_store_state', 'custom_wcv_vendor_store_state');
@fervous
fervous / functions.php
Created March 2, 2018 03:27
Change Variations and Atrributes to Options and Price Options WC Vendors Pro
/* attribute(s) to option(s) */
add_filter( 'gettext', 'wcv_translate_attributes', 999 );
function wcv_translate_attributes( $translated ) {
$translated = str_ireplace( 'attributes', 'Options', $translated );
return $translated;
}
add_filter( 'gettext', 'wcv_translate_attribute', 999 );