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 | |
// Displays any voucher numbers on the New Order admin email | |
add_action( 'woocommerce_email_order_meta', function( $order, $is_admin ) { | |
if ( $is_admin ) { | |
$voucher_numbers = array(); | |
$order_items = $order->get_items(); |
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_filter( 'wc_tab_manager_product_tabs', 'wc_tab_manager_product_tabs' ); | |
function wc_tab_manager_product_tabs( $tabs ) { | |
global $product; | |
foreach ( $tabs as $tab_name => $tab ) { |
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 | |
/* | |
* Returns a set of admin custom order field options from the database, rather | |
* than as configured by the admin | |
*/ | |
add_filter( 'wc_admin_custom_order_field_options', function( $options, $field ) { | |
global $wpdb; |
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 the following to your theme's functions.php: | |
add_action( 'woocommerce_order_status_pending_to_processing_notification', 'watch_for_processing_email', 5 ); | |
add_action( 'woocommerce_order_status_pending_to_on-hold_notification', 'watch_for_processing_email', 5 ); | |
function watch_for_processing_email() { | |
// only add the instructions for processing type emails | |
add_action( 'woocommerce_email_before_order_table', 'add_order_email_instructions', 10, 2 ); |
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_filter( 'woocommerce_cart_shipping_method_full_label', 'woocommerce_flat_rate_custom_label', 10, 2 ); | |
function woocommerce_flat_rate_custom_label( $label, $method ) { | |
if ( 'flat_rate' == $method->id && 0 == $method->cost ) { | |
$label = $method->label . ' (will be calculated)'; | |
} | |
return $label; | |
} |
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 | |
// Create and use a randomized voucher number | |
function serial_p4u( $number, $voucher ) { | |
// if we've already generated a custom voucher number, get it and return it | |
if ( $voucher->get_item_id() ) { | |
$custom_serial = wc_get_order_item_meta( $voucher->get_item_id(), '_voucher_custom_number', true ); | |
if ( $custom_serial ) { | |
return $custom_serial; |
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 everything below to your current theme's functions.php file | |
add_filter( 'woocommerce_tab_manager_tab_panel_content', 'wc_tab_manager_global_tab_product_specific_content', 10, 3 ); | |
function wc_tab_manager_global_tab_product_specific_content( $content, $tab, $product ) { | |
// tab by title slug | |
if ( 'product-specifications' == $tab['name'] ) { |
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 the code below to the bottom of your current theme's functions.php: | |
function woocommerce_nested_category_products_content_section( $categories, $product_category_ids ) { | |
global $wp_query, $wc_nested_category_layout; | |
$title = ''; | |
$term = ''; |
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 everything below to your current theme's functions.php: | |
// The email to send can be changed by using a different filter in place of 'woocommerce_email_recipient_new_order' | |
// The payment method can be changed by using a different payment method id in place of 'cod' | |
add_filter( 'woocommerce_email_recipient_new_order', 'wc_new_order_cash_on_delivery_recipient', 10, 2 ); | |
function wc_new_order_cash_on_delivery_recipient( $recipient, $order ) { |
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 the following to the bottom of your current theme's functions.php | |
add_filter( 'woocommerce_sale_price_html', 'remove_price_per_unit_html', 15, 2 ); | |
add_filter( 'woocommerce_price_html', 'remove_price_per_unit_html', 15, 2 ); | |
add_filter( 'woocommerce_empty_price_html', 'remove_price_per_unit_html', 15, 2 ); | |
add_filter( 'woocommerce_variable_sale_price_html', 'remove_price_per_unit_html', 15, 2 ); | |
add_filter( 'woocommerce_variable_price_html', 'remove_price_per_unit_html', 15, 2 ); | |
add_filter( 'woocommerce_variable_empty_price_html', 'remove_price_per_unit_html', 15, 2 ); |