Skip to content

Instantly share code, notes, and snippets.

remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
<?php
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_first_name']);
unset($fields['billing']['billing_last_name']);
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_address_1']);
unset($fields['billing']['billing_address_2']);
<?php
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_first_name']);
unset($fields['billing']['billing_last_name']);
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_address_1']);
unset($fields['billing']['billing_address_2']);
@ddbs
ddbs / woocommerce-remove-from-price.php
Created March 22, 2014 23:58 — forked from BFTrick/woocommerce-remove-from-price.php
Disable the WooCommerce variable product "From: $X" price.
<?php
/**
* Plugin Name: WooCommerce Remove Variation "From: $XX" Price
* Plugin URI: https://gist.github.com/BFTrick/7643587
* Description: Disable the WooCommerce variable product "From: $X" price.
* Author: Patrick Rauland
* Author URI: http://patrickrauland.com/
* Version: 1.0
*
* This program is free software: you can redistribute it and/or modify
@ddbs
ddbs / gist:9716258
Created March 22, 2014 23:53 — forked from kloon/gist:4015723
WooCommerce Change empty price text
// Change empty price
function custom_empty_price( $price, $product ) {
return __( 'Call or Email for price', 'WooCommerce' ) ;
}
add_filter( 'woocommerce_variable_empty_price_html', 'custom_empty_price', 10, 2 );
add_filter( 'woocommerce_empty_price_html', 'custom_empty_price', 10, 2 );
@ddbs
ddbs / gist:9716257
Created March 22, 2014 23:53 — forked from kloon/gist:4162957
WooCommerce remove from: price
// Change from text on price
function custom_from_price_html( $price, $product ) {
if ( strpos( $price, 'From: ' ) <> false )
return str_replace( 'From: ', '', $price ) . __( ' and up', 'woocommerce');
else return $price;
}
add_filter( 'woocommerce_get_price_html', 'custom_from_price_html', 10, 2 );
@ddbs
ddbs / functions.php
Created March 22, 2014 23:53 — forked from kloon/functions.php
WooCommerce add "Save x%" next to sale prices
<?php
// Add save percent next to sale item prices.
add_filter( 'woocommerce_sale_price_html', 'woocommerce_custom_sales_price', 10, 2 );
function woocommerce_custom_sales_price( $price, $product ) {
$percentage = round( ( ( $product->regular_price - $product->sale_price ) / $product->regular_price ) * 100 );
return $price . sprintf( __(' Save %s', 'woocommerce' ), $percentage . '%' );
}
?>
@ddbs
ddbs / functions.php
Created March 22, 2014 23:52 — forked from kloon/functions.php
WooCommerce Mark Virtual Product Orders Completed
<?php
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 ( $order_status == 'processing' &&
( $order->status == 'on-hold' || $order->status == 'pending' || $order->status == 'failed' ) ) {
$virtual_order = true;
@ddbs
ddbs / functions.php
Created March 22, 2014 23:52 — forked from kloon/functions.php
WooCommerce CC all emails
<?php
add_filter('woocommerce_email_headers', 'woo_cc_emails' );
function woo_cc_emails() {
return 'Bcc: [email protected]' . "\r\n";
}
?>
@ddbs
ddbs / functions.php
Created March 22, 2014 23:52 — forked from kloon/functions.php
WooCommerce Previous & Next product links
<?php
// Add previous and next links to products under the product details
add_action( 'woocommerce_single_product_summary', 'wc_next_prev_products_links', 60 );
function wc_next_prev_products_links() {
previous_post_link( '%link', '< Previous' );
echo ' | ';
next_post_link( '%link', 'Next >' );
}
?>