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_action( 'woocommerce_single_product_summary', 'show_product_cost', 15 ); | |
function show_product_cost() { | |
global $product; | |
$item_cost = get_post_meta( $product->id, '_wc_cog_cost', true ); |
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_action( 'woocommerce_order_actions_start', function() { | |
global $post_id; | |
$order = new WC_Order( $post_id ); | |
if ( class_exists( 'WC_Subscriptions_Order' ) && WC_Subscriptions_Order::order_contains_subscription( $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_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; | |
} |
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 | |
// 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 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 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 ); |
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
// add everything below this point to the bottom of your current theme's functions.php | |
function prepend_thumbnail_rss( $content ) { | |
global $post; | |
if ( has_post_thumbnail( $post->ID ) ) { | |
$content = get_the_post_thumbnail( $post->ID, 'full' ) . $content; | |
} | |
return $content; | |
} | |
add_filter( 'the_excerpt_rss', 'prepend_thumbnail_rss' ); | |
add_filter( 'the_content_feed', 'prepend_thumbnail_rss' ); |
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 | |
// Put the following in your theme's functions.php for instance: | |
add_filter( 'wc_pdf_product_vouchers_voucher_fields', 'wc_pdf_product_vouchers_add_custom_fields', 10, 2 ); | |
/** | |
* Adds some custom fields to the given product voucher | |
* |
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 functions.php | |
// assumes a copy of the core class-wc-shortcodes.php, customized, is available at path/to/custom/class-wc-shortcodes.php | |
add_action( 'woocommerce_loaded', 'use_custom_wc_shortcodes' ); | |
function use_custom_wc_shortcodes() { | |
// load our custom shortcodes class |