Skip to content

Instantly share code, notes, and snippets.

@bentasm1
bentasm1 / move-proceed-to-checkout
Created February 18, 2016 05:17 — forked from BurlesonBrad/move-proceed-to-checkout
Get the friggin' Proceed To Checkout button to the TOP of the page (not the bottom!!)
add_action( 'woocommerce_before_cart', 'move_proceed_button' );
function move_proceed_button( $checkout ) {
echo '<a href="' . esc_url( WC()->cart->get_checkout_url() ) . '" class="checkout-button button alt wc-forward" >' . __( 'Proceed to Checkout', 'woocommerce' ) . '</a>';
}
@bentasm1
bentasm1 / functions.php
Last active February 16, 2016 02:04 — forked from digitalchild/functions.php
Give vendors permissions to edit media
<?php
// The following functions will allow a vendor to edit and delete their media alt text and descriptions.
// HOWEVER this requires post editing permissions so would also allow them to edit ALL posts and comments on
// your site if they know how to do it.
// WC Vendors will not support this code and is provided for educational purposes only.
// THIS IS DANGEROUS TO DO -- USE AT YOUR OWN RISK -- YOU HAVE BEEN WARNED!
// Update vendor role to support media handling
function update_vendor_role( ){
@bentasm1
bentasm1 / functions.php
Created February 7, 2016 17:29 — forked from digitalchild/functions.php
WC Vendors Pro - Function to output vendor ratings/feedback in side bar
// Put this in your themes function.php
function vendor_feedback_sidebar() {
if ( is_shop() ) {
$vendor_shop = urldecode( get_query_var( 'vendor_shop' ) );
$vendor_id = WCV_Vendors::get_vendor_id( $vendor_shop );
if ( ! WCVendors_Pro::get_option( 'ratings_management_cap' ) ) echo WCVendors_Pro_Ratings_Controller::ratings_link( $vendor_id, true );
}
} // vendor_feedback_sidebar()
// call this in your side bar
@bentasm1
bentasm1 / functions.php
Last active January 12, 2017 16:30 — forked from digitalchild/functions.php
How to make a field required in WC Vendors Pro
To require, or not to require, that is the question...... In the future, we'll make these into checkboxes to require/not require,
but for now you use filters. Add this code to your themes functions.php file. Here's the process:
1.) Find the filter for the field you want to adjust the requirements. This file is in /plugins/wc-vendors-pro/public/forms/class-wcvendors-pro-product-form.php
2.) Create a filter for each field you'd like to make required (or not required). The code below will make the description required:
/* WC Vendors Pro - Make Description Required */
function wcv_product_description_required( $args ) {
$args[ 'custom_attributes' ] = array(
@bentasm1
bentasm1 / product-edit.php
Created January 6, 2016 02:07 — forked from digitalchild/product-edit.php
WC Vendors Pro Form Input Type Examples
<?php
/**
* Example text input with validation
*/
WCVendors_Pro_Form_Helper::input(
array(
'post_id' => $object_id,
'id' => '_wcv_custom_product_example_text_input',
'label' => __( 'Product Meta Text Input', 'wcvendors-pro' ),
@bentasm1
bentasm1 / functions.php
Last active May 30, 2020 15:50 — forked from digitalchild/functions.php
Add custom link to pro dashboard navigation tabs
/* WC Vendors Pro - Add a custom link to your Pro Dashboard navigation bar */
add_filter( 'wcv_pro_dashboard_urls', 'custom_menu_link' );
function custom_menu_link( $pages ) {
$pages[ 'custom_link' ] = array(
'slug' => 'http://yoursite.com/customlink/here', // Change this to whatever you like, it must be a full URL
'label' => __('My Custom Link', 'wcvendors-pro' ),
'actions' => array()
);
return $pages;
}
@bentasm1
bentasm1 / jetpack-bot-challenge-text-change.php
Created December 11, 2015 03:16 — forked from digisavvy/jetpack-bot-challenge-text-change.php
Change Jetpack Protect Bot Challenge Text
/**
* Change text string for Jetpack Protect Bot Challenge Text
*
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/
function digisavvy_change_humanity_string( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Prove your humanity:' :
$translated_text = __( 'Prove you\'re not a bot', 'jetpack' );
break;
@bentasm1
bentasm1 / functions.php
Last active September 13, 2016 14:57 — forked from digitalchild/wcv_vendors_menu
WC Vendors Free & Pro Dynamic Vendor Menus
// Place this in your themes functions.php
// This will put the menu item in your primary menu. Change the theme location if you want to change which menu this goes in.
// Use the Free code for WC Vendors Free, use the Pro code for WC Vendors Pro
/* BEGIN WC Vendors Free */
add_filter( 'wp_nav_menu_items', 'wcv_vendors_menu', 10, 2 );
function wcv_vendors_menu ( $items, $args ) {
if ($args->theme_location == 'primary') {
$vendors = get_users( array( 'role' => 'vendor' ) );
$items .= '<li><a href="#">Vendors</a>';
@bentasm1
bentasm1 / functions.php
Last active June 8, 2017 14:21 — forked from digitalchild/functions.php
Add a custom field to the store settings page for WCVendors Pro
This code adds a custom field to the Dashboard > Settings page for your vendors to
provide you extra bits of info you may need from them. Duplicate for each custom field you need,
renaming the meta keys and functions each time so they are not duplicated.
Part #1 - Theme functions.php file:
/* WC Vendors Pro - My Custom Field */
function store_bank_details( ){
if ( class_exists( 'WCVendors_Pro' ) ){
$key = '_wcv_custom_settings_bankname';
@bentasm1
bentasm1 / functions.php
Created November 7, 2015 18:54 — forked from digitalchild/functions.php
Only display the sold by if the product owner is a vendor
<?php
// Put this in your themes functions.php
// Remove all existing actions and filters
remove_action( 'woocommerce_after_shop_loop_item', array( 'WCV_Vendor_Shop', 'template_loop_sold_by'), 9, 2);
remove_filter( 'woocommerce_get_item_data', array( 'WCV_Vendor_Cart', 'sold_by' ), 10, 2 );
remove_action( 'woocommerce_product_meta_start', array( 'WCV_Vendor_Cart', 'sold_by_meta' ), 10, 2 );
remove_filter( 'woocommerce_order_product_title', array( 'WCV_Emails', 'show_vendor_in_email' ), 10, 2 );
remove_action( 'woocommerce_add_order_item_meta', array( 'WCV_Vendor_Shop', 'add_vendor_to_order_item_meta'), 10, 2 );
remove_action( 'woocommerce_after_shop_loop_item', array( $wcvendors_pro->wcvendors_pro_store_controller, 'loop_sold_by' ), 8 );