This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 | |
// Code to display catalog images in a lightbox follows: | |
add_action( 'wp_enqueue_scripts', 'frontend_scripts_include_lightbox' ); | |
function frontend_scripts_include_lightbox() { | |
global $woocommerce; | |
if ( is_shop() || is_product_category() ) { |
This file contains hidden or 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_payment_gateway_elavon_vm_request_xml', 'wc_payment_gateway_elavon_vm_add_custom_fields', 10, 2 ); | |
function wc_payment_gateway_elavon_vm_add_custom_fields( $request_xml, $request ) { | |
$request_xml->addChild( 'ssl_name_on_card', str_replace( array( '&', '<', '>' ), '', $request->ssl_first_name . ' ' . $request->ssl_last_name ) ); | |
return $request_xml; | |
} |