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 April 9, 2019 02:52
WC Vendors Pro tweaks
<?php
// remove shipping column from orders table
add_filter( 'wcv_order_table_columns', 'remove_shipping' );
function remove_shipping( $columns ){
unset( $columns[ 'status' ] );
return $columns;
}
@digitalchild
digitalchild / functions.php
Created August 27, 2019 03:32
Make the commission csv output format the same as the commissions table for WC Vendors Marketplace
<?php
add_filter( 'wcv_commissions_export_columns', 'commission_export_columns', 1 );
function commission_export_columns( $columns ){
$columns = array(
'order_id' => __( 'Order ID', 'wc-vendors' ),
'vendor_id' => sprintf( __( '%s', 'wc-vendors' ), wcv_get_vendor_name() ),
'product_id' => __( 'Product', 'wc-vendors' ),
'qty' => __( 'QTY', 'wc-vendors' ),
@digitalchild
digitalchild / paypal_ap.php
Last active December 11, 2022 08:26
[WC Vendors] Paypal Adaptive Payments - Chained
<?php
if ( !class_exists( 'WC_Payment_Gateway' ) ) return false;
/**
* Add the gateway to WooCommerce
*
* @access public
* @param array $methods
* @return array
@digitalchild
digitalchild / gist:3ae1539f5ee8fb69711f
Last active December 11, 2022 07:22
Product Vendor Recent Products
/*
The following code will create a pv_recent_products short code that is a duplicate of the internal woocommerce
shortcode for recent products (See : http://docs.woothemes.com/document/woocommerce-shortcodes/) but provides a
new attribute 'login'. This will filter the results by author allowing you to have recent products per vendor.
Please Note: This code relies on a 3rd party plugin from Matt Gates. (http://shop.mgates.me/shop/wc-marketing/wc-product-vendor/)
Usage: [pv_recent_products per_page="5" login="usernicename" ]
All attributes are documentent on the woocommerce docs page above.
@digitalchild
digitalchild / functions.php
Created March 14, 2022 03:51
Add the vendor role to an instructor when they are approved.
<?php
/**
* Required Tutor LMS v.1.6.0
*/
add_action('tutor_new_instructor_after', 'wcv_add_vendor_role');
/**
* @param $instructor_id
*
@digitalchild
digitalchild / functions.php
Created February 9, 2022 04:01
Force product type, hide tabs and show only price field on WC Vendors Product Edit Standard form.
<?php
// Disable the product type drop down.
add_filter('wcv_disable_product_type', function() { return true; } );
add_filter( 'wcv_product_meta_tabs', function() { return array(); } );
// Adjust styles of the product tabs after removing them.
add_action('wp_head', 'wcv_add_custom_styles', 10);
function wcv_add_custom_styles() {
echo "<style>.tabs-nav { display: none!important;}</style>";
@digitalchild
digitalchild / functions.php
Created January 19, 2022 07:04
Disable the orders page on the WC Vendors Pro dashboard.
<?php
/**
* Disable existing order page hook into the dashboard links filter
*
* filter: wcv_pro_dashboard_urls
*/
add_filter( 'wcv_pro_dashboard_urls', 'wcv_remove_order_page' );
function wcv_remove_order_page( $pages ){
@digitalchild
digitalchild / functions.php
Created February 5, 2016 04:36
Custom Fields to Shop Settings Page
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' => __( 'Bank Name', 'wcvendors-pro' ),
'placeholder' => __( 'First Bank', 'wcvendors-pro' ),
'desc_tip' => 'true',
@digitalchild
digitalchild / functions.php
Created May 13, 2021 03:16
Add a checkbox to the product page and save itr
<?php
add_action( 'wcv_after_product_type', 'wcv_checkbox_check' );
function wcv_checkbox_check( $object_id ){
$value = get_post_meta( $object_id, 'wcv_custom_product_checkbox3', true );
WCVendors_Pro_Form_Helper::input( array(
'id' => 'wcv_custom_product_checkbox3',
'label' => __( 'Personalisation', 'wcvendors-pro' ),
'type' => 'checkbox',
'desc_tip' => true,
@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 ); ?>