Skip to content

Instantly share code, notes, and snippets.

View MarkKevin08's full-sized avatar

MarkKevin08

View GitHub Profile
@bentasm1
bentasm1 / functions.php
Created November 12, 2015 17:16
WC Vendors Pro -- Change defaults for Stock Management / Quantity / Sold Individually
/* Credit to @criticalachievement */
// Changes the default value for manage stock checkbox to 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';
@digitalchild
digitalchild / functions.php
Last active March 3, 2023 04:35
Add custom link to pro dashboard navigation
<?php
// Add this to your themes function.php change the values to suit where you want the link to go.
// slug needs to be a complete URL.
function custom_menu_link( $pages ) {
$pages[ 'custom_link' ] = array(
'slug' => 'http://yoursite.com/customlink/here',
'label' => __('Custom Link', 'wcvendors-pro' ),
@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 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
Last active July 13, 2021 01:45
Disable mark received and order status table in WC Vendors Pro
<?php
// remove status from order table
add_filter( 'wcv_order_table_columns', 'remove_shipping' );
function remove_shipping( $columns ){
unset( $columns[ 'status' ] );
return $columns;
}
// Disable mark recieved system completely
@digitalchild
digitalchild / functions.php
Last active December 29, 2020 07:54
Set a range on the price field for WC Vendors Pro
<?php
add_filter ('wcv_product_price', 'price_min_max');
add_filter ('wcv_product_sale_price', 'price_min_max');
function price_min_max ($args) {
$args ['custom_attributes'] = array (
'data-parsley-range' => '[10, 100]'
);
return $args;
}
@digitalchild
digitalchild / vendors-list.php
Last active February 19, 2021 08:30
WC Vendors Marketplace vendor list using WC Vendors Pro store icon
<?php
/**
* Vendor List Template
*
* This template can be overridden by copying it to yourtheme/wc-vendors/front/vendors-list.php
*
* @author Jamie Madden, WC Vendors
* @package WCVendors/Templates/
* @version 2.0.0
*
@digitalchild
digitalchild / functions.php
Created April 22, 2020 06:25
Make the apply to be a vendor checkbox for WC Vendors Marketplace checked
add_action( 'woocommerce_register_form', 'load_js' );
function load_js(){?>
<script type="text/javascript">
jQuery('#apply_for_vendor').prop('checked', true);
</script>
<?php }
@digitalchild
digitalchild / functions.php
Last active May 13, 2023 01:35
Add 16% VAT to vendors commission.
<?php
// Add 16% VAT to vendor commission
add_filter( 'wcv_commission_rate', 'my_wcv_commission_rate', 10, 5 );
function my_wcv_commission_rate( $commission, $product_id, $product_price, $order, $qty ) {
$vat_fee = 0.16;
$marketplace_split = $product_price - $commission;
$vat = $marketplace_split * $vat_fee;
$commission -= $vat;
@junenacpil29
junenacpil29 / gist:5fa35000caaa6d3c9a56d88b142ac526
Created September 21, 2020 08:51
WC Vendors | Show both the State and Country, but not city or house address
add_filter( 'wcv_format_store_address_args', 'my_wcv_format_store_address', 11, 2 );
function my_wcv_format_store_address( $address_args, $vendor_id ) {
$address_args = array(
'country' => WC()->countries->countries[ get_user_meta( $vendor_id, '_wcv_store_country', true ) ],
'city' => get_user_meta( $vendor_id, '_wcv_store_city', true ),
);
return $address_args;
}