This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Place the following code in your theme's functions.php file | |
// override the quantity input with a dropdown | |
function woocommerce_quantity_input() { | |
global $product; | |
$defaults = array( | |
'input_name' => 'quantity', | |
'input_value' => '1', | |
'max_value' => apply_filters( 'woocommerce_quantity_input_max', '', $product ), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Buy BTC & ETH daily on Luno.com | |
* @author Gerhard Potgieter <potgieterg@gmail.com> | |
* @since 2017-12-07 | |
* https://www.luno.com/invite/JN5Z4 | |
* | |
* This script will do a daily purchase of BTC and ETH on Luno.com based on rand value (ZAR) set. Default to R100 each. Why daily? https://en.wikipedia.org/wiki/Dollar_cost_averaging | |
* | |
* Installation Instructions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add a date range to a datepicker field, replace #date with the id of the date field. | |
add_filter( 'wp_footer' , 'woo_add_checkout_field_date_range_limit' ); | |
function woo_add_checkout_field_date_range_limit() { | |
if ( is_checkout() ) { | |
$js = 'jQuery( "#date" ).datepicker({ minDate: -5, maxDate: "+1M +10D" });'; | |
// Check if WC 2.1+ | |
if ( defined( 'WC_VERSION' ) && WC_VERSION ) { | |
wc_enqueue_js( $js ); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// add custom field to invoice email | |
add_action( 'woocommerce_email_after_order_table', 'woocommerce_custom_invoice_fields' ); | |
function woocommerce_custom_invoice_fields( $order ) { | |
?> | |
<p><strong><?php _e('Free Book:', 'woocommerce'); ?></strong> <?php echo get_post_meta( $order->id, 'Free Book', true ); ?></p> | |
<p><strong><?php _e('Free DVD:', 'woocommerce'); ?></strong> <?php echo get_post_meta( $order->id, 'Free DVD', true ); ?></p> | |
<p><strong><?php _e('Gift:', 'woocommerce'); ?></strong> <?php echo get_post_meta( $order->id, 'Gift Order', true ); ?></p> | |
<p><strong><?php _e('Gift Message:', 'woocommerce'); ?></strong> <?php echo get_post_meta( $order->id, 'Special Gift Message', true ); ?></p> | |
<?php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This adds back an option to resend the admin new order email from the order edit screen that was removed in WooCommerce 3.2 | |
*/ | |
/** | |
* Filter to add a new menu to the dropdown | |
* | |
* @param array $actions | |
* @return array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Display Fields | |
add_action( 'woocommerce_product_after_variable_attributes', 'variable_fields', 10, 2 ); | |
//JS to add fields for new variations | |
add_action( 'woocommerce_product_after_variable_attributes_js', 'variable_fields_js' ); | |
//Save variation fields | |
add_action( 'woocommerce_process_product_meta_variable', 'variable_fields_process', 10, 1 ); | |
function variable_fields( $loop, $variation_data ) { | |
?> | |
<tr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add to functions.php | |
/*=================================================== | |
Created by sk from Renegade Empire with help | |
from these sources: | |
http://docs.woothemes.com/document/editing-product-data-tabs/ | |
http://www.sean-barton.co.uk/2013/03/remove-woocommerce-20-reviews-tab/#.UYnWe7XfB6N | |
http://www.sean-barton.co.uk/2013/03/sb-add-woocommerce-tabs-wordpress-plugin/#.UYrYL7XfB6M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Place the code below in your theme's functions.php file | |
add_filter( 'woocommerce_get_catalog_ordering_args', 'wc_get_catalog_ordering_args' ); | |
function wc_get_catalog_ordering_args( $args ) { | |
$orderby_value = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) ); | |
if ( 'sales' == $orderby_value ) { | |
$args['orderby'] = 'meta_value_num'; | |
$args['order'] = 'DESC'; | |
$args['meta_key'] = 'total_sales'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_bacs_fields', 'woocommerce_bacs_custom_sort_code_text', 10, 1 ); | |
function woocommerce_bacs_custom_sort_code_text( $fields ) { | |
$fields['sort_code'] = 'BSB'; | |
return $fields; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Place the following code in your theme's functions.php file to add the shipping method to all emails | |
add_action( 'woocommerce_email_after_order_table', 'wc_add_shipping_method_to_emails', 15, 2 ); | |
function wc_add_shipping_method_to_emails( $order, $is_admin_email ) { | |
echo '<p><strong>Shipping Method:</strong> ' . $order->get_shipping_method() . '</p>'; | |
} | |
// Place the following code in your theme's functions.php file to add the shipping methid to admin emails only | |
add_action( 'woocommerce_email_after_order_table', 'wc_add_shipping_method_to_admin_emails', 15, 2 ); | |
function wc_add_shipping_method_to_admin_emails( $order, $is_admin_email ) { |