Skip to content

Instantly share code, notes, and snippets.

View BurlesonBrad's full-sized avatar
🎯
Focusing

Brad Griffin BurlesonBrad

🎯
Focusing
View GitHub Profile
// Custom CSS to change Variation Dropdown //
.woocommerce div.product form.cart .variations select {
width: 190px;
float: left;
background: -webkit-linear-gradient(top, rgb(255, 255, 255) 0%,rgb(194, 204, 228) 100%);
border-radius: 5px;
border: 1px solid rgba(0,0,0,0.3);
box-shadow: 0 0 5px 1px rgba(0,0,0,0.2), inset 0 1px 0 0px rgba(255,255,255,0.3);
margin: 50px;
}
<?php
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_address_1']);
unset($fields['billing']['billing_address_2']);
unset($fields['billing']['billing_city']);
unset($fields['billing']['billing_postcode']);
unset($fields['billing']['billing_country']);
unset($fields['billing']['billing_state']);
@BurlesonBrad
BurlesonBrad / Default Quantity NOT changed
Created April 13, 2015 05:27
Modified quantity added to themes/theonepager-child/woocommerce/checkout/add-to-cart
<?php
/**
* Product quantity input
*
* Extends the WooCommerce quantity input template to include the add_to_cart data attribute.
*
* @package WooCommerce-One-Page-Checkout/Templates
* @version 1.0
*/
<?php
/**
* Admin new order email
*
* @author WooThemes
* @package WooCommerce/Templates/Emails/HTML
* @version 2.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
@BurlesonBrad
BurlesonBrad / Border Control
Created May 27, 2015 18:49
Block Everything But the United States
This file has been truncated, but you can view the full file.
# BLOCK COUNTRY BY IP RANGE
# IncrediBILL's HTACCESS Tools
# http://incredibill.me
<Limit GET POST HEAD>
order allow,deny
#
# Block from AFGHANISTAN (AF)
#
deny from 27.116.56.0/22
deny from 43.231.131.0/24
@BurlesonBrad
BurlesonBrad / Line 374 of wc-template-functions.php
Created May 28, 2015 15:59
Add html to WooCommerce Storewide Notice
echo apply_filters( 'woocommerce_demo_store', '<p class="demo_store">' . '<a href ="https://www.facebook.com/groups/advanced.woocommerce/permalink/1087929507888134/">' . $notice .'</a>' . '</p>' );
@BurlesonBrad
BurlesonBrad / Manja
Created July 7, 2015 22:07
For Manja
// Our hooked in function - $fields is passed via the filter!
function dropdown( $fields ) {
$fields['billing']['dropdown'] = array(
'label' => __('Howdy Manja. Would You Like Your Order Gift Wrapped for Free?', 'woocommerce'),
'placeholder' => _x('dropdown', 'placeholder', 'woocommerce'),
'required' => false,
'class' => array('form-row-wide'),
'clear' => true,
'type' => 'select',
'options' => array(
function woo_custom_wp_mail_from() {
global $woocommerce;
return html_entity_decode( 'daves.email@daves-favorite-spot-on-the-innerwebs.com' );
}
add_filter( 'wp_mail_from', 'woo_custom_wp_mail_from', 99 );
@BurlesonBrad
BurlesonBrad / Here 'ya go
Created July 16, 2015 18:08
For WarFarePlugins
/**
* Redirect user to checkout page directly after adding to cart
*
* @return string
*/
function wc_redirect_to_checkout() {
$checkout_url = WC()->cart->get_checkout_url();
return $checkout_url;
}
@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' );