Skip to content

Instantly share code, notes, and snippets.

View fervous's full-sized avatar

Anna fervous

View GitHub Profile
@fervous
fervous / functions.php
Last active February 7, 2017 05:53
Paid Memberships Pro ( PMPRO ) WC Vendors - Give VENDOR role upon subscription
// PAID MEMBERSHIPS PRO -- UPGRADE TO VENDOR, DOWNGRADE TO SUBSCRIBER
/*
Members signing up for membership level #1 get "Vendor" role.
Members signing up for membership level #2 get "Vendor" role.
Members cancelling are given the customer role.
Admin users are ignored.
*/
function my_pmpro_after_change_membership_level($level_id, $user_id)
{
@fervous
fervous / gist:44178b88d9c51a9b294d898b32294f61
Created August 16, 2016 01:49
filter add text to wc vendors pro product-edit.php
add_filter('wcv_product_upsells', 'custom_wcv_product_upsells');
function custom_wcv_product_upsells( $args ){
$args['label'] = 'Up-Sells <span style ="font-size:11px; font weight:normal;">Your message here.......</span>';
return $args;
}
@fervous
fervous / gist:2b9035f51f1de43eb3aa353787038a0f
Last active March 12, 2017 02:18
only one vendor's items in the cart at once- one vendor checkout. (haven't tested yet 8/22/2016 )
//Order only from 1 shop
//https://www.wcvendors.com/help/topic/restrict-clientbuyer-to-order-from-one-vendor-at-a-time/
add_filter( 'woocommerce_add_cart_item_data', 'woo_custom_add_to_cart' );
function woo_custom_add_to_cart( $cart_item_data ) {
global $woocommerce;
$items = $woocommerce->cart->get_cart(); //getting cart items
$_product = array();
foreach($items as $item => $values) {
$_product[] = $values['data']->post;
@fervous
fervous / wc vendors pro - vendor product meta icon & link php for functions.php
Last active August 25, 2016 03:18
vendor icon and links for meta products page
@fervous
fervous / gist:3b36fefac27fed7bb623dd60f35540bc
Created September 1, 2016 21:56
product description working - store description not working
add_filter('wcv_product_description', 'custom_wcv_product_description');
function custom_wcv_product_description( $args ){
$args['label'] = 'PRODUCT DESCRIPTION <br><i class="fa fa-info-circle" aria-hidden="true"></i><span style ="font-size:11px; font weight:400;"> REQUIRED. Describe your product in detail for your customers. Include size, materials &amp; any relevant information here.</span>';
return $args;
}
add_filter('wcv_vendor_store_description', 'custom_wcv_vendor_store_description');
function custom_wcv_vendor_store_description( $args ){
$args['label'] = 'SHOP DESCRIPTION <br><i class="fa fa-info-circle" aria-hidden="true"></i><span style ="font-size:11px; font weight:400;">Optional. Give a brief, keyword-rich description of your shop. This is used with SEO. This will be shown under your shop banner on your storefront.</span>';
@fervous
fervous / functions.php
Last active December 14, 2016 00:42 — forked from digitalchild/functions.php
Add a description / tip to fields on the WC Vendors Pro front end.
<?php
add_filter('wcv_product_description', 'custom_wcv_product_description');
function custom_wcv_product_description( $args ){
$args['desc_tip'] = true;
$args['description'] = 'REQUIRED. Describe your product in detail for your customers. Include size, materials &amp; any relevant information here.';
return $args;
}
@fervous
fervous / product-edit.php
Last active December 8, 2016 00:53
Ensure Stripe is set BEFORE product can be listed
<?php
/**
* The template for displaying the Product edit form
*
* Override this template by copying it to yourtheme/wc-vendors/dashboard/
*
* @package WCVendors_Pro
* @version 1.3.2
*/
/**
@fervous
fervous / product-edit.php
Created September 2, 2016 23:42
Ensure Paypal is entered BEFORE a product can be listed
<?php
/**
* The template for displaying the Product edit form
*
* Override this template by copying it to yourtheme/wc-vendors/dashboard/
*
* @package WCVendors_Pro
* @version 1.3.2
*/
/**
@fervous
fervous / gist:2437ee5944015f6436af27e76641e8a4
Created September 3, 2016 03:02 — forked from bentasm1/gist:8cd5706b6bc6194e0ea4f5e8f487e32d
Warn vendors if they dont have some custom field set
/* This will warn a vendor if some magical meta key isnt set. Change it to the one you need in the code below: */
// Get the users meta key we want to check.
$the_meta_key = get_user_meta( get_current_user_id(), 'CHANGEME', true ); // CHANGE CHANGEME TO THE META KEY NAME YOU WANT TO CHECK.
// DEBUG STUFF. UNCOMMENT TO CHECK STUFF.
// echo '<pre>THE META KEY IS: ' . $the_meta_key . '</pre>';
// Check if meta key is set
if (!isset($the_meta_key)) {
@fervous
fervous / functions.php
Created September 3, 2016 03:40 — forked from bentasm1/functions.php
WC Vendors Pro - Change "Settings" on Pro Dashboard to another name
/* WC Vendors Pro - Change the Settings tab on the Pro Dashboard navigation to say "New Label" (or whatever) instead */
function custom_menu_link( $pages ) {
$pages[ 'settings' ] = array(
'slug' => 'settings',
'label' => __('New Label', 'wcvendors-pro' ),
'actions' => array()
);
return $pages;
}