diff --git a/includes/class-wc-cart.php b/includes/class-wc-cart.php index ff36aac5223..1eafc889f2b 100644 --- a/includes/class-wc-cart.php +++ b/includes/class-wc-cart.php @@ -2118,6 +2118,21 @@ class WC_Cart { return apply_filters( 'woocommerce_cart_subtotal', $cart_subtotal, $compound, $this ); } + /** + * Get the product row price per item. + * + * @params object product + * @return string formatted price + */ + public function get_product_price( $_product ) { + if ( $this->tax_display_cart == 'excl' ) + $product_price = $_product->get_price_excluding_tax(); + else + $product_price = $_product->get_price_including_tax(); + + return apply_filters( 'woocommerce_cart_product_price', woocommerce_price( $product_price ), $_product ); + } + /** * Get the product row subtotal. * diff --git a/includes/wc-deprecated-functions.php b/includes/wc-deprecated-functions.php index e17fd1640a0..ecd2e21cde8 100644 --- a/includes/wc-deprecated-functions.php +++ b/includes/wc-deprecated-functions.php @@ -12,8 +12,39 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly - function woocommerce_show_messages() { _deprecated_function( 'woocommerce_show_messages', '2.1', 'wc_print_messages' ); wc_show_messages(); +} + +/** + * Handle renamed filters + */ +global $wc_map_deprecated_filters; + +$wc_map_deprecated_filters = array( + 'woocommerce_cart_item_class' => 'woocommerce_cart_table_item_class', + 'woocommerce_cart_item_product_id' => 'hook_woocommerce_in_cart_product_id', + 'woocommerce_cart_item_thumbnail' => 'hook_woocommerce_in_cart_product_thumbnail', + 'woocommerce_cart_item_price' => 'woocommerce_cart_item_price_html', + 'woocommerce_cart_item_name' => 'woocommerce_in_cart_product_title', + 'woocommerce_order_item_class' => 'woocommerce_order_table_item_class', + 'woocommerce_order_item_name' => 'woocommerce_order_table_product_title' +); + +foreach ( $wc_map_deprecated_filters as $new => $old ) + add_filter( $new, 'woocommerce_deprecated_filter_mapping' ); + +function woocommerce_deprecated_filter_mapping( $data, $arg_1 = '', $arg_2 = '', $arg_3 = '' ) { + global $wc_map_deprecated_filters; + + $filter = current_filter(); + + if ( isset( $wc_map_deprecated_filters[ $filter ] ) ) + if ( has_filter( $wc_map_deprecated_filters[ $filter ] ) ) { + $data = apply_filters( $wc_map_deprecated_filters[ $filter ], $arg_1, $arg_2, $arg_3 ); + _deprecated_function( 'The ' . $wc_map_deprecated_filters[ $filter ] . ' filter', '2.1', $filter ); + } + + return $data; } \ No newline at end of file diff --git a/templates/cart/cart.php b/templates/cart/cart.php index 1f4a0c0695a..a9cc6994823 100755 --- a/templates/cart/cart.php +++ b/templates/cart/cart.php @@ -4,7 +4,7 @@ * * @author WooThemes * @package WooCommerce/Templates - * @version 1.6.4 + * @version 2.1.0 */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly @@ -12,9 +12,8 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly global $woocommerce; wc_print_messages(); -?> - +do_action( 'woocommerce_before_cart' ); ?>