Skip to content

Instantly share code, notes, and snippets.

Nick Burne nickburne

Block or report user

Report or block nickburne

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nickburne
nickburne / gist:192609fedc540654fd9b
Last active Sep 16, 2015
Replace add to cart button with button to product page - WooCommerce
View gist:192609fedc540654fd9b
/*PUT THIS IN YOUR CHILD THEME FUNCTIONS FILE*/
/*STEP 1 - REMOVE ADD TO CART BUTTON ON PRODUCT ARCHIVE (SHOP) */
function remove_loop_button(){
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
}
add_action('init','remove_loop_button');
@nickburne
nickburne / Delete the sidebar in WooCommerce
Created Apr 30, 2014
Delete the sidebar in WooCommerce
View Delete the sidebar in WooCommerce
<?php get_header(); ?>
<div id="container">
<div id="content-wrap">
<?php woocommerce_content(); ?>
</div>
</div>
<?php get_footer(); ?>
@nickburne
nickburne / Add a background image to the shop page only in WooCommerce
Created Apr 30, 2014
Add a background image to the shop page only in WooCommerce
View Add a background image to the shop page only in WooCommerce
add_filter( 'wp_head', 'wo_custom_shop_background' );
function wo_custom_shop_background() {
if( is_shop() && !is_admin() ) {
?>
<style>
body {
background: url(http://blogs.smithsonianmag.com/smartnews/files/2013/08/06177001.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
@nickburne
nickburne / Customise ‘add to cart’ text on single product pages in WooCommerce
Created Apr 30, 2014
Customise ‘add to cart’ text on single product pages in WooCommerce
View Customise ‘add to cart’ text on single product pages in WooCommerce
add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' ); // < 2.1
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text' ); // 2.1 +
function woo_custom_cart_button_text() {
return __( 'My Button Text', 'woocommerce' );
}
@nickburne
nickburne / Add a checkbox field to checkout with a simple snippet in WooCommerce
Created Apr 30, 2014
Add a checkbox field to checkout with a simple snippet in WooCommerce
View Add a checkbox field to checkout with a simple snippet in WooCommerce
<?php
/**
* Add checkbox field to the checkout
**/
add_action('woocommerce_after_order_notes', 'my_custom_checkout_field');
function my_custom_checkout_field( $checkout ) {
echo '<div id="my-new-field"><h3>'.__('My Checkbox: ').'</h3>';
woocommerce_form_field( 'my_checkbox', array(
'type' => 'checkbox',
'class' => array('input-checkbox'),
@nickburne
nickburne / Automatically mark orders as ‘complete’ in WooCommerce
Created Apr 30, 2014
Automatically mark orders as ‘complete’ in WooCommerce
View Automatically mark orders as ‘complete’ in WooCommerce
add_filter( 'woocommerce_payment_complete_order_status', 'virtual_order_payment_complete_order_status', 10, 2 );
function virtual_order_payment_complete_order_status( $order_status, $order_id ) {
$order = new WC_Order( $order_id );
if ( 'processing' == $order_status &&
( 'on-hold' == $order->status || 'pending' == $order->status || 'failed' == $order->status ) ) {
$virtual_order = null;
if ( count( $order->get_items() ) > 0 ) {
foreach( $order->get_items() as $item ) {
if ( 'line_item' == $item['type'] ) {
$_product = $order->get_product_from_item( $item );
@nickburne
nickburne / Alter the default state and country at the checkout
Created Apr 30, 2014
Alter the default state and country at the checkout
View Alter the default state and country at the checkout
/**
* Manipulate default state and countries
*
* As always, code goes in your theme functions.php file
*/
add_filter( 'default_checkout_country', 'change_default_checkout_country' );
add_filter( 'default_checkout_state', 'change_default_checkout_state' );
function change_default_checkout_country() {
return 'XX'; // country code
}
@nickburne
nickburne / Automatically complete orders in WooCommerce
Created Apr 30, 2014
Automatically complete orders in WooCommerce
View Automatically complete orders in WooCommerce
/**
* Auto Complete all WooCommerce orders.
* Add to theme functions.php file
*/
add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' );
function custom_woocommerce_auto_complete_order( $order_id ) {
global $woocommerce;
if ( !$order_id )
@nickburne
nickburne / Remove duplicate stars on your product
Created Apr 29, 2014
Remove duplicate stars on your product
View Remove duplicate stars on your product
.star-rating span:before, ul.products li.product .product-details .star-rating:before {
content:none;
}
You can’t perform that action at this time.