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_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 | |
// 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 following to the bottom of your theme's functions.php | |
add_action( 'woocommerce_payment_complete', 'set_pip_invoice_number' ); | |
function set_pip_invoice_number( $order_id ) { | |
$order = new WC_Order( $order_id ); | |
if ( in_array( $order->status, array( 'processing', 'completed' ) ) && function_exists( 'woocommerce_pip_invoice_number' ) ) { | |
woocommerce_pip_invoice_number( $order_id ); |
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 end of your theme's functions.php | |
// Add the following to the end of your theme's functions.php | |
add_action( 'woocommerce_email_order_meta', 'wc_pdf_product_vouchers_email_voucher_numbers', 10, 3 ); | |
function wc_pdf_product_vouchers_email_voucher_numbers( $order, $sent_to_admin, $plain_text ) { | |
if ( class_exists( 'WC_PDF_Product_Vouchers_Order' ) ) { | |
$vouchers = WC_PDF_Product_Vouchers_Order::get_vouchers( $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 | |
function woocommerce_subcategory_thumbnail( $category ) { | |
global $woocommerce; | |
// Modification: don't show the image for subcategories | |
if ( $category->parent ) return; | |
$small_thumbnail_size = apply_filters( 'single_product_small_thumbnail_size', 'shop_catalog' ); | |
$image_width = $woocommerce->get_image_size( 'shop_catalog_image_width' ); | |
$image_height = $woocommerce->get_image_size( 'shop_catalog_image_height' ); |
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( 'plugins_url', 'allow_symlink_plugins_url', 10, 3 ); | |
/** | |
* Allow symlinked plugins to function. This was made necessary by a change in | |
* the standard WooCommerce plugin_url() method from: | |
* | |
* plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ); | |
* |
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_catalog_settings', 'add_woocommerce_weight_unit_xx' ); | |
/** | |
* This adds the new unit to the WooCommerce admin | |
*/ | |
function add_woocommerce_weight_unit_xx( $settings ) { | |
foreach ( $settings as &$setting ) { | |
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_get_price_html', 'wc_hide_product_page_price_per_unit', 11, 2 ); | |
function wc_hide_product_page_price_per_unit( $price_html, $product ) { | |
// if this is a product variation, get the parent product which holds the calculator settings | |
$_product = $product; | |
if ( isset( $product->variation_id ) && $product->variation_id ) { $_product = WC_Price_Calculator_Product::get_product( $product->id ); } |
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( 'wc_sequential_order_numbers_is_free_order', 'wc_sequential_order_numbers_is_free_order', 10, 2 ); | |
function wc_sequential_order_numbers_is_free_order( $is_free, $order_id ) { | |
if ( $is_free ) { | |
$order = new WC_Order( $order_id ); | |
// lets make sure the items truly are free, and not just on sale, or discounted with a coupon | |
foreach ( $order->get_items() as $item ) { | |
$product = $order->get_product_from_item( $item ); |
OlderNewer