Skip to content

Instantly share code, notes, and snippets.

View BurlesonBrad's full-sized avatar
🎯
Focusing

Brad Griffin BurlesonBrad

🎯
Focusing
View GitHub Profile
@BurlesonBrad
BurlesonBrad / custom-add-to-cart-button
Created September 16, 2015 15:32
Add To Cart Button | Text Field in General Tab | Appears on Single Product Page
<?php
//=======================================================
// Custom Add to Cart Buttons
//=======================================================
// Display Fields
add_action( 'woocommerce_product_options_general_product_data', 'woo_add_custom_general_fields' );
// Save Fields
add_action( 'woocommerce_process_product_meta', 'woo_add_custom_general_fields_save' );
@BurlesonBrad
BurlesonBrad / postcode_shipping.php
Created September 23, 2015 02:06 — forked from KZeni/postcode_shipping.php
Updated Postcode Shipping plugin for WordPress that supports Shipping Multiple Addresses in one cart.
<?php
/**
* Plugin Name: Postcode Shipping
* Description: This plugin allows you to set a flat shipping rate per country or state or postcode per Quantity/Order on WooCommerce.
* Version: 2.1.2
@BurlesonBrad
BurlesonBrad / modification
Created September 27, 2015 23:35
GOAL = Remove flat rate when quantity is OVER 12
add_filter('woocommerce_available_shipping_methods','remove_flat_over_twelve',10,1);
function remove_flat_over_twelve( $available_methods ) {
global $woocommerce;
$minimum_flat_rate_quantity = 12;
if ( $woocommerce->cart->get_cart_contents_count() >= $minimum_flat_rate_quantity ) {
// remove flat_rate shipping
unset($available_methods['flat_rate']);
}
return $available_methods;
@BurlesonBrad
BurlesonBrad / Sensei Points
Last active October 10, 2015 19:17
Attempt to connect Completing a Sensei LESSON to points and rewards
<?php
// THIS IS THE FILE FROM https://gist.github.com/woogist/5692886#file-gistfile1-php//
// ...and, believe it or not, I understand about 50% of this.//
// While that's better than the average Joe, it' still not enough to actually CONNECT the points //
// Anyone want to jump in here? //
// Add the action setting
add_filter( 'wc_points_rewards_action_settings', 'bkg_sensei_points' );
function points_rewards_newsletter_action_settings( $settings ) {
/* Howdy Steve. See down there where it says 250%? Add this code to your child style.css file */
/* Once you've got this code added, change that number to whatever percentage you think looks good */
.site-header .site-branding img, .site-header .site-logo-anchor img, .site-header .site-logo-link img {
height: auto;
max-width: 250%;
max-height: none;
}
/* End Custom Logo Size */
/* Howdy Paris! Add this to your child functions.php file and it should remove the additional variation number */
function paris_custom_variation_price( $price, $product ) {
$target_product_types = array(
'variable'
);
if ( in_array ( $product->product_type, $target_product_types ) ) {
// if variable product return and empty string
return '';
}
/* Marco, add all this to your child theme's functions.php file */
/* Bye Emoji :-( */
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
/* ...so sad */
/* Lets really optimize this js hooplah */
@BurlesonBrad
BurlesonBrad / Steve's
Created October 28, 2015 21:16
Autocomplete Steve | Steve Completes Me | NO, I AutoComplete Steve
/* I now pronounce you AUTOCOMPLETED. You may take your money! */
add_filter( 'woocommerce_payment_complete_order_status', 'steve_got_hitched_so_autocomplete_virtual_orders', 10, 2 );
function steve_got_hitched_so_autocomplete_virtual_orders( $order_status, $order_id ) {
$order = wc_get_order( $order_id );
if ('processing' == $order_status && ('on-hold' == $order->status || 'pending' == $order->status || 'failed' == $order->status)) {
$virtual_order = '';
@BurlesonBrad
BurlesonBrad / nick
Last active November 13, 2015 08:14
nick
// Begin Speed Tweaks //
function remove_cssjs_ver( $src ) {
if( strpos( $src, '?ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'remove_cssjs_ver', 10, 2 );
add_filter( 'script_loader_src', 'remove_cssjs_ver', 10, 2 );
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
@BurlesonBrad
BurlesonBrad / wpfixit
Last active November 13, 2015 23:47
wpfixit
add_action( 'wp_dashboard_setup', 'register_my_dashboard_widget' );
function register_my_dashboard_widget() {
wp_add_dashboard_widget(
'my_dashboard_widget',
'WpFixIt Sales At A Glance',
'my_dashboard_widget_display'
);
}