Skip to content

Instantly share code, notes, and snippets.

@davidtowoju
davidtowoju / vendor-managers-fire.php
Created January 18, 2018 13:41
Fires the previous code to turn subscribers to vendor manager
add_action( 'user_register', 'figarts_make_users_vendors_wrapper', 10, 1 );
@davidtowoju
davidtowoju / vendor-managers.php
Created January 18, 2018 13:19
Create WooCommerce vendor managers on user registration
/**
* Turn all subscribers into Woo Vendors
*/
function figarts_make_users_vendors( $user_id ) {
if (!defined('WC_PRODUCT_VENDORS_TAXONOMY')){
return;
}
@davidtowoju
davidtowoju / customize-add-to-cart-message.php
Last active January 12, 2018 14:00
Change WooCommerce 3.0+ “has been added to cart” message
function mytheme_custom_add_to_cart_message($message, $product_id = null) {
$titles[] = get_the_title( key($product_id));
$titles = array_filter( $titles );
$added_text = sprintf( _n( '%s has been added to cart.', '%s have been added to cart', sizeof( $titles ), 'woocommerce' ), wc_format_list_of_items( $titles ) ); //Change the message here
$message = sprintf( '%s <a href="%s" class="button">%s</a>',
esc_html( $added_text ),
esc_url( wc_get_page_permalink( 'checkout' ) ), // Change to esc_url( wc_get_page_permalink( 'cart' ) ), if you want users to go to cart
esc_html__( 'Pay Now', 'woocommerce' ));
@davidtowoju
davidtowoju / custom_menu_admin.php
Created October 4, 2017 16:52 — forked from carlodaniele/custom_menu_admin.php
A basic plugin showing how to add menu metaboxes to admin menu page
<?php
/**
* @package Custom_menu_admin
* @version 1.0
*/
/*
Plugin Name: Custom menu admin
Plugin URI: http://wordpress.org/extend/plugins/#
Description: This is an example plugin
Author: Carlo Daniele