Skip to content

Instantly share code, notes, and snippets.

View digitalchild's full-sized avatar

Jamie Madden digitalchild

View GitHub Profile
@digitalchild
digitalchild / gist:f8567d4f277248ee15421f284bb06463
Created September 27, 2021 04:14
Remove fixed product discounts from the vendor coupon edit screen for WC Vendors Pro dashboard
<?php
/**
* Remove fixed product discounts from the vendor coupon edit screen
*/
add_filter( 'wcv_coupon_discount_type', 'wcv_use_percentage_discount_type' );
function wcv_use_percentage_discount_type( $select_args ){
unset( $select_args['options']['fixed_product']);
return $select_args;
}
@digitalchild
digitalchild / functions.php
Created September 7, 2021 04:35
Update the seller info label for settings and sign up forms for WC Vendors Pro
<?php
// Update the label if you're using the wp_editor setting
add_filter( 'wcv_vendor_seller_info_editor', 'wcv_update_editor_seller_info_label' );
function wcv_update_editor_seller_info_label( $label ){
return __( 'Driver Bio', 'wcvendors-pro' );
}
// Update the label if you are using the standard text area setting
add_filter( 'wcv_vendor_seller_info', 'wcv_update_seller_info_label' );
function wcv_update_seller_info_label( $field ){
@digitalchild
digitalchild / functions.php
Created August 12, 2021 05:14
Remove this.
<?php
/**
*GOOGLE ANALYTICS POUR VENDEURS
Add the Google Analytics Tracking ID field to the settings page for vendors
*/
add_action( 'wcvendors_settings_after_vendor_store_notice', 'wcv_add_ga_code' );
function wcv_add_ga_code(){
$value = get_user_meta( get_current_user_id(), '_wcv_custom_settings_ga_tracking_id', true );
@digitalchild
digitalchild / gist:4ccea0918a6cd96406b5eb1b64ecdb1b
Created August 11, 2021 04:08
Add a custom page and load a template from you theme dir for WC Vendors Pro.
<?php
// Add the menu item
add_filter( 'wcv_pro_dashboard_urls', 'add_test_page_nav', 9 );
function add_test_page_nav( $pages ){
$pages[ 'help_page' ] = array(
'slug' => 'help_page',
'id' => 'help_page',
'label' => __( 'Help', 'wcvendors-pro' ),
@digitalchild
digitalchild / functions.php
Created August 7, 2021 04:38
Change the Product Tab order in WC Vendors Pro Product Edit form
<?php
// Add this to your themes functions.php
// Here are two different ways you can sort the product tabs
// Use ksort to alphabetically sort the tabs
add_filter( 'wcv_product_meta_tabs', 'wcv_change_product_tab_order_alphabetical' );
function wcv_change_product_tab_order_alphabetical( $tabs ){
ksort( $tabs );
return $tabs;
@digitalchild
digitalchild / functions.php
Created July 29, 2021 09:15
Override the vendor seller info field in WC Vendors Pro Dashboard
<?php
// Add this to your themes functions.php
// Use the filter in the first argument found in the class-wcvendors-pro-store-form.php
add_filter( 'wcv_vendor_seller_info', 'custom_wcv_vendor_seller_info' );
function custom_wcv_vendor_seller_info( $args ){
$args['label'] = 'About Us';
$args['desc_tip'] = true;
$args['description'] = 'Helper text under field';
@digitalchild
digitalchild / functions.php
Created July 23, 2021 06:08
Use WC Vendors Pro form helper to output a custom taxonomy checklist
<?php
// WC Vendors Pro 1.7.10 or above required.
/**
* Taxonomy: location.
*/
function wcv_register_my_location_taxonomy() {
$labels = [
@digitalchild
digitalchild / functions.php
Created July 16, 2021 08:24
Add a div wrapper around the price and add to cart elements on the product loop for WooCommerce
<?php
// Author: Jamie Madden
// Link: https://wcvendors.com
// Remove product price from the loop
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
// New overrides
add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
@digitalchild
digitalchild / functions.php
Created July 3, 2021 05:06
Override the WC Vendors Pro Dashboard open partial
<?php
// This will assume you have created a directory in your theme called wc-vendors/partials/
// Then added the override file here.
add_filter( 'wcvendors_pro_dashboard_open_path', 'wcv_override_dashboard_open_path' );
function wcv_override_dashboard_open_path( $path ){
$path = get_stylesheet_directory(). '/wc-vendors/partials/wcvendors-pro-dashboard-open.php';
return $path;
}
@digitalchild
digitalchild / functions.php
Created June 29, 2021 07:53
Disable All in One SEO on the WC Vendors Dashboard
<?php
/**
* Disable All In One SEO on the vendor dashboard.
*/
add_filter( 'aioseo_disable', 'wcv_aioseo_disable_term_output' );
function wcv_aioseo_disable_term_output( $disabled ) {
$current_page_id = get_the_ID();
if ( wcv_is_dashboard_page( $current_page_id ) ){