Skip to content

Instantly share code, notes, and snippets.

View tiffy23's full-sized avatar

Stephanie Jagl-Posch tiffy23

View GitHub Profile
@mikejolley
mikejolley / gist:2263203
Last active June 1, 2019 17:50
WooCommerce - Add custom field (in an order) to the order emails
/**
* Add the field to order emails
**/
add_filter('woocommerce_email_order_meta_keys', 'my_woocommerce_email_order_meta_keys');
function my_woocommerce_email_order_meta_keys( $keys ) {
$keys['How did you hear about us?'] = 'hear_about_us';
return $keys;
}
@jameskoster
jameskoster / functions.php
Last active October 5, 2020 17:34
WooCommerce - Remove product data tabs
add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );
function woo_remove_product_tabs( $tabs ) {
unset( $tabs['description'] ); // Remove the description tab
unset( $tabs['reviews'] ); // Remove the reviews tab
unset( $tabs['additional_information'] ); // Remove the additional information tab
return $tabs;
@woogist
woogist / gist:6267983
Created August 19, 2013 11:06
WooCommerce - Display checkout custom field on the order edition page
/**
* Display field value on the order edition page
**/
add_action( 'woocommerce_admin_order_data_after_billing_address', 'my_custom_checkout_field_display_admin_order_meta', 10, 1 );
function my_custom_checkout_field_display_admin_order_meta($order){
echo '<p><strong>'.__('My Field').':</strong> ' . $order->order_custom_fields['My Field'][0] . '</p>';
}
@corsonr
corsonr / gist:7370707
Created November 8, 2013 13:00
WooCommerce - display order coupons used in confirmation email and edit order page
add_action( 'woocommerce_email_after_order_table', 'add_payment_method_to_admin_new_order', 15, 2 );
/**
* Add used coupons to the order confirmation email
*
*/
function add_payment_method_to_admin_new_order( $order, $is_admin_email ) {
if ( $is_admin_email ) {
@bekarice
bekarice / wc-remove-shipping-free-label.php
Last active February 4, 2019 23:16
Remove (Free) after WooCommerce free shipping methods
//Remove (Free) label on cart page for "Shipping and Handling" if cost is $0
function wc_change_cart_shipping_free_label( $label ) {
$label = str_replace( "(Free)", " ", $label );
return $label;
}
add_filter( 'woocommerce_cart_shipping_method_full_label' , 'wc_change_cart_shipping_free_label' );
@bekarice
bekarice / remove-currency-symbols.php
Last active May 30, 2020 15:09
Change or Remove WooCommerce currency symbol + currency symbols for other plugins
/**
* These snippets can alter or remove currency symbols from several eCommerce plugins
* They are not made to be used together! I didn't feel like creating 1MM gists :)
* Tutorial: http://www.sellwithwp.com/pricing-remove-currency-symbol/
**/
/**
* WooCommerce
**/
@craigsimps
craigsimps / functions.php
Created April 18, 2015 16:16
Add custom meta field to WooCommerce order email.
add_filter('woocommerce_email_order_meta_fields', 'dog_breed_checkout_field_order_meta_fields', 10, 3 );
function dog_breed_checkout_field_order_meta_fields( $fields, $sent_to_admin, $order ) {
$fields['dog_breed_name'] = array(
'label' => __( 'Dog Breed' ),
'value' => get_post_meta( $order->id, 'dog_breed_name', true ),
);
return $fields;
}