Skip to content

Instantly share code, notes, and snippets.

// Add Cart to Checkout //
add_action( 'woocommerce_before_checkout_form', 'lk_show_cart', 5 );
function lk_show_cart()
{
global $woocommerce;
?>
<form action="<?php echo esc_url( $woocommerce->cart->get_cart_url() ); ?>" method="post">
function lk_aussie_gateways( $available_gateways ) {
global $woocommerce;
if ($woocommerce->customer->get_country() == 'AU') {
unset( $available_gateways['cod'] );
}
return $available_gateways;
add_filter( 'comments_template', 'USEGENERIC_woocommerce_comments', 100);
function USEGENERIC_woocommerce_comments( $template ) {
$template = STYLESHEETPATH . '/comments.php';
return $template;
}
add_filter('woocommerce_billing_fields', 'custom_woocommerce_billing_fields');
function custom_woocommerce_billing_fields( $fields ) {
$fields['billing_address_1']['class'] = array( 'form-group' );
$fields['billing_address_1']['input_class'] = array( 'form-control' );
return $fields;
}
add_filter( 'woocommerce_product_tax_class', 'big_apple_get_tax_class', 1, 2 );
function big_apple_get_tax_class( $tax_class, $product ) {
global $woocommerce;
if ( $woocommerce->cart->subtotal <= 110 )
$tax_class = 'Zero Rate';
return $tax_class;
}
<?php
add_filter( 'woocommerce_get_catalog_ordering_args', 'custom_woocommerce_get_catalog_ordering_args' );
function custom_woocommerce_get_catalog_ordering_args( $args ) {
if( isset ( $_SESSION['orderby'] ) ) {
switch ( $_SESSION['orderby'] ) {
case 'sku_asc' :
$args['orderby'] = 'meta_value';
$args['order'] = 'asc';
$args['meta_key'] = '_sku';
break;
// 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' );
function woo_add_custom_general_fields() {
global $woocommerce, $post;
function laudes_woocommerce_breadcrumbs() {
return array(
'delimiter' => ' &#47; ',
'wrap_before' => '<nav class="woocommerce-breadcrumb" itemprop="breadcrumb">',
'wrap_after' => '</nav>',
'before' => '',
'after' => '',
'home' => _x( 'Home', 'breadcrumb', 'woocommerce' ),
);
}
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 );
@diekaines
diekaines / wp-query-ref.php
Created October 5, 2012 04:18 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(