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 / 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 = '';
/* 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 */
/* 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 '';
}
/* 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 */
@BurlesonBrad
BurlesonBrad / move-proceed-to-checkout.php
Last active November 28, 2020 17:41
Put Checkout button next to the Update Cart button (AWESOME on mobile!!) https://bradgriffin.me/proceed-to-checkout/
add_action( 'woocommerce_cart_actions', '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>';
}
@BurlesonBrad
BurlesonBrad / move-proceed-to-checkout
Created October 18, 2015 21:44
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>';
}
@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 / 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 / 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 / Add To Cart Text
Created September 16, 2015 15:26
Add to Cart Text
<?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' );