Merge pull request #1 from woothemes/master

Update to base
This commit is contained in:
Peter 2015-12-23 18:06:34 +01:00
commit 5463e18998
5 changed files with 21 additions and 14 deletions

View File

@ -683,9 +683,10 @@ abstract class WC_Abstract_Order {
}
// Now calculate shipping tax
$matched_tax_rates = array();
$shipping_methods = $this->get_shipping_methods();
if ( ! empty( $shipping_methods ) ) {
$matched_tax_rates = array();
$tax_rates = WC_Tax::find_rates( array(
'country' => $country,
'state' => $state,
@ -693,18 +694,21 @@ abstract class WC_Abstract_Order {
'city' => $city,
'tax_class' => ''
) );
}
if ( ! empty( $tax_rates ) ) {
foreach ( $tax_rates as $key => $rate ) {
if ( isset( $rate['shipping'] ) && 'yes' === $rate['shipping'] ) {
$matched_tax_rates[ $key ] = $rate;
if ( ! empty( $tax_rates ) ) {
foreach ( $tax_rates as $key => $rate ) {
if ( isset( $rate['shipping'] ) && 'yes' === $rate['shipping'] ) {
$matched_tax_rates[ $key ] = $rate;
}
}
}
}
$shipping_taxes = WC_Tax::calc_shipping_tax( $this->order_shipping, $matched_tax_rates );
$shipping_tax_total = WC_Tax::round( array_sum( $shipping_taxes ) );
$shipping_taxes = WC_Tax::calc_shipping_tax( $this->order_shipping, $matched_tax_rates );
$shipping_tax_total = WC_Tax::round( array_sum( $shipping_taxes ) );
} else {
$shipping_taxes = array();
$shipping_tax_total = 0;
}
// Save tax totals
$this->set_total( $shipping_tax_total, 'shipping_tax' );

View File

@ -100,7 +100,7 @@ class WC_Admin {
delete_transient( '_wc_activation_redirect' );
if ( ( ! empty( $_GET['page'] ) && in_array( $_GET['page'], array( 'wc-setup' ) ) ) || is_network_admin() || isset( $_GET['activate-multi'] ) || ! current_user_can( 'manage_woocommerce' ) ) {
if ( ( ! empty( $_GET['page'] ) && in_array( $_GET['page'], array( 'wc-setup' ) ) ) || is_network_admin() || isset( $_GET['activate-multi'] ) || ! current_user_can( 'manage_woocommerce' ) || apply_filters( 'woocommerce_prevent_automatic_wizard_redirect', false ) ) {
return;
}

View File

@ -984,7 +984,6 @@ class WC_Meta_Box_Product_Data {
update_post_meta( $post_id, '_sale_price', '' );
update_post_meta( $post_id, '_sale_price_dates_from', '' );
update_post_meta( $post_id, '_sale_price_dates_to', '' );
update_post_meta( $post_id, '_price', '' );
} else {
$date_from = isset( $_POST['_sale_price_dates_from'] ) ? wc_clean( $_POST['_sale_price_dates_from'] ) : '';

View File

@ -720,8 +720,11 @@ class WC_Product_Variable extends WC_Product {
) );
// No published variations - product won't be purchasable.
if ( ! $children && 'publish' === get_post_status( $product_id ) ) {
if ( is_admin() ) {
if ( ! $children ) {
update_post_meta( $product_id, '_price', '' );
delete_transient( 'wc_products_onsale' );
if ( is_admin() && 'publish' === get_post_status( $product_id ) ) {
WC_Admin_Meta_Boxes::add_error( __( 'This variable product has no active variations. Add or enable variations to allow this product to be purchased.', 'woocommerce' ) );
}

View File

@ -442,11 +442,12 @@ class WC_Tax {
// This will be per order shipping - loop through the order and find the highest tax class rate
$cart_tax_classes = WC()->cart->get_cart_item_tax_classes();
// If multiple classes are found, use highest. Don't bother with standard rate, we can get that later.
// If multiple classes are found, use the first one. Don't bother with standard rate, we can get that later.
if ( sizeof( $cart_tax_classes ) > 1 && ! in_array( '', $cart_tax_classes ) ) {
$tax_classes = self::get_tax_classes();
foreach ( $tax_classes as $tax_class ) {
$tax_class = sanitize_title( $tax_class );
if ( in_array( $tax_class, $cart_tax_classes ) ) {
$matched_tax_rates = self::find_shipping_rates( array(
'country' => $country,