Skip to content

Instantly share code, notes, and snippets.

View digitalchild's full-sized avatar

Jamie Madden digitalchild

View GitHub Profile
@digitalchild
digitalchild / functions.php
Created November 9, 2021 06:43
Add inventory fields to product-simple.php template for WC Vendors Pro
add_action( 'wcv_after_product_simple_after', 'wcv_add_inventory_fields' );
function wcv_add_inventory_fields( $object_id ){
?>
<!-- Inventory -->
<div class="wcv-product-inventory inventory_product_data tabs-content" id="inventory">
<?php WCVendors_Pro_Product_Form::manage_stock( $object_id ); ?>
<?php do_action( 'wcv_product_options_stock', $object_id ); ?>
@digitalchild
digitalchild / functions.php
Last active September 28, 2021 03:22
Add custom links to the vendor dashboard in WC Vendors Pro
<?php
// Sourced from https://docs.wcvendors.com/knowledge-base/add-menu-item-to-dashboard/
// Add this to your themes functions.php.
function wcv_add_menu_item( $pages ){
$pages[] = array(
'label' => 'First Page',
'slug' => 'http://wcvendors.com/support',
'actions' => array()
);
@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 );