Shipping method tweaks/api to add multiple rates easily.
This commit is contained in:
parent
ca0e9744ab
commit
28922bb4ef
|
@ -657,9 +657,9 @@ function woocommerce_process_product_meta( $post_id, $post ) {
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
// Upsells
|
// Upsells
|
||||||
if (isset($_POST['_upsell_ids'])) :
|
if (isset($_POST['upsell_ids'])) :
|
||||||
$upsells = array();
|
$upsells = array();
|
||||||
$ids = $_POST['_upsell_ids'];
|
$ids = $_POST['upsell_ids'];
|
||||||
foreach ($ids as $id) :
|
foreach ($ids as $id) :
|
||||||
if ($id && $id>0) $upsells[] = $id;
|
if ($id && $id>0) $upsells[] = $id;
|
||||||
endforeach;
|
endforeach;
|
||||||
|
@ -669,9 +669,9 @@ function woocommerce_process_product_meta( $post_id, $post ) {
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
// Cross sells
|
// Cross sells
|
||||||
if (isset($_POST['_crosssell_ids'])) :
|
if (isset($_POST['crosssell_ids'])) :
|
||||||
$crosssells = array();
|
$crosssells = array();
|
||||||
$ids = $_POST['_crosssell_ids'];
|
$ids = $_POST['crosssell_ids'];
|
||||||
foreach ($ids as $id) :
|
foreach ($ids as $id) :
|
||||||
if ($id && $id>0) $crosssells[] = $id;
|
if ($id && $id>0) $crosssells[] = $id;
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
|
@ -955,9 +955,9 @@ class woocommerce_cart {
|
||||||
|
|
||||||
$this->shipping_total = $woocommerce->shipping->shipping_total; // Shipping Total
|
$this->shipping_total = $woocommerce->shipping->shipping_total; // Shipping Total
|
||||||
$this->shipping_label = $woocommerce->shipping->shipping_label; // Shipping Label
|
$this->shipping_label = $woocommerce->shipping->shipping_label; // Shipping Label
|
||||||
$this->shipping_tax_total = $woocommerce->shipping->shipping_tax; // Shipping tax amount
|
$this->shipping_tax_total = array_sum( $woocommerce->shipping->shipping_taxes ); // Shipping tax amount
|
||||||
|
|
||||||
// Shipping tax rows
|
// Merge Shipping tax rows with cart tax rows
|
||||||
if (is_array($woocommerce->shipping->shipping_taxes) && sizeof($woocommerce->shipping->shipping_taxes)>0) :
|
if (is_array($woocommerce->shipping->shipping_taxes) && sizeof($woocommerce->shipping->shipping_taxes)>0) :
|
||||||
// Tax rows - merge the totals we just got
|
// Tax rows - merge the totals we just got
|
||||||
foreach (array_keys($this->taxes + $woocommerce->shipping->shipping_taxes) as $key) {
|
foreach (array_keys($this->taxes + $woocommerce->shipping->shipping_taxes) as $key) {
|
||||||
|
|
|
@ -118,9 +118,9 @@ class flat_rate extends woocommerce_shipping_method {
|
||||||
|
|
||||||
$_tax = &new woocommerce_tax();
|
$_tax = &new woocommerce_tax();
|
||||||
|
|
||||||
$this->shipping_total = 0;
|
$this->rates = array();
|
||||||
$this->shipping_tax = 0;
|
$shipping_taxes = array();
|
||||||
$this->shipping_taxes = array();
|
$shipping_total = 0;
|
||||||
|
|
||||||
if ($this->type=='order') :
|
if ($this->type=='order') :
|
||||||
|
|
||||||
|
@ -167,16 +167,20 @@ class flat_rate extends woocommerce_shipping_method {
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
// Shipping for whole order
|
// Shipping for whole order
|
||||||
$this->shipping_total = $cost + $this->get_fee( $fee, $woocommerce->cart->cart_contents_total );
|
$shipping_total = $cost + $this->get_fee( $fee, $woocommerce->cart->cart_contents_total );
|
||||||
|
|
||||||
if ( get_option('woocommerce_calc_taxes')=='yes' && $this->tax_status=='taxable' ) :
|
if ( get_option('woocommerce_calc_taxes')=='yes' && $this->tax_status=='taxable' ) :
|
||||||
$rate = $_tax->get_shipping_tax_rates();
|
$rates = $_tax->get_shipping_tax_rates();
|
||||||
if ($rate>0) :
|
$shipping_taxes = $_tax->calc_shipping_tax( $shipping_total, $rates );
|
||||||
$tax_amount = $_tax->calc_shipping_tax( $this->shipping_total, $rate );
|
|
||||||
$this->shipping_tax = $this->shipping_tax + $tax_amount;
|
|
||||||
endif;
|
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
$rate = array(
|
||||||
|
'id' => $this->id,
|
||||||
|
'label' => $this->title,
|
||||||
|
'cost' => $shipping_total,
|
||||||
|
'taxes' => $shipping_taxes
|
||||||
|
);
|
||||||
|
|
||||||
elseif ($this->type=='class') :
|
elseif ($this->type=='class') :
|
||||||
// Shipping per class
|
// Shipping per class
|
||||||
$cost = null;
|
$cost = null;
|
||||||
|
@ -216,15 +220,19 @@ class flat_rate extends woocommerce_shipping_method {
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
// Total
|
// Total
|
||||||
$this->shipping_total = $cost + $fee;
|
$shipping_total = $cost + $fee;
|
||||||
|
|
||||||
if ( get_option('woocommerce_calc_taxes')=='yes' && $this->tax_status=='taxable' ) :
|
if ( get_option('woocommerce_calc_taxes')=='yes' && $this->tax_status=='taxable' ) :
|
||||||
$rate = $_tax->get_shipping_tax_rates();
|
$rates = $_tax->get_shipping_tax_rates();
|
||||||
if ($rate>0) :
|
$shipping_taxes = $_tax->calc_shipping_tax( $shipping_total, $rates );
|
||||||
$tax_amount = $_tax->calc_shipping_tax( $this->shipping_total, $rate );
|
|
||||||
$this->shipping_tax = $this->shipping_tax + $tax_amount;
|
|
||||||
endif;
|
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
$rate = array(
|
||||||
|
'id' => $this->id,
|
||||||
|
'label' => $this->title,
|
||||||
|
'cost' => $shipping_total,
|
||||||
|
'taxes' => $shipping_taxes
|
||||||
|
);
|
||||||
|
|
||||||
elseif ($this->type=='item') :
|
elseif ($this->type=='item') :
|
||||||
|
|
||||||
|
@ -247,7 +255,7 @@ class flat_rate extends woocommerce_shipping_method {
|
||||||
|
|
||||||
$item_shipping_price = ( $cost + $fee ) * $values['quantity'];
|
$item_shipping_price = ( $cost + $fee ) * $values['quantity'];
|
||||||
|
|
||||||
$this->shipping_total = $this->shipping_total + $item_shipping_price;
|
$shipping_total = $shipping_total + $item_shipping_price;
|
||||||
|
|
||||||
if ( $_product->is_shipping_taxable() && $this->tax_status=='taxable' ) :
|
if ( $_product->is_shipping_taxable() && $this->tax_status=='taxable' ) :
|
||||||
|
|
||||||
|
@ -256,8 +264,8 @@ class flat_rate extends woocommerce_shipping_method {
|
||||||
$item_taxes = $_tax->calc_shipping_tax( $item_shipping_price, $rates );
|
$item_taxes = $_tax->calc_shipping_tax( $item_shipping_price, $rates );
|
||||||
|
|
||||||
// Sum the item taxes
|
// Sum the item taxes
|
||||||
foreach (array_keys($this->shipping_taxes + $item_taxes) as $key) {
|
foreach (array_keys($shipping_taxes + $item_taxes) as $key) {
|
||||||
$this->shipping_taxes[$key] = (isset($item_taxes[$key]) ? $item_taxes[$key] : 0) + (isset($this->shipping_taxes[$key]) ? $this->shipping_taxes[$key] : 0);
|
$shipping_taxes[$key] = (isset($item_taxes[$key]) ? $item_taxes[$key] : 0) + (isset($shipping_taxes[$key]) ? $shipping_taxes[$key] : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
endif;
|
endif;
|
||||||
|
@ -265,9 +273,17 @@ class flat_rate extends woocommerce_shipping_method {
|
||||||
endif;
|
endif;
|
||||||
endforeach; endif;
|
endforeach; endif;
|
||||||
|
|
||||||
$this->shipping_tax = array_sum( $this->shipping_taxes );
|
$rate = array(
|
||||||
|
'id' => $this->id,
|
||||||
|
'label' => $this->title,
|
||||||
|
'cost' => $shipping_total,
|
||||||
|
'taxes' => $shipping_taxes
|
||||||
|
);
|
||||||
|
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
// Register the rate
|
||||||
|
$this->add_rate( $rate );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -159,9 +159,13 @@ class free_shipping extends woocommerce_shipping_method {
|
||||||
}
|
}
|
||||||
|
|
||||||
function calculate_shipping() {
|
function calculate_shipping() {
|
||||||
$this->shipping_total = 0;
|
$args = array(
|
||||||
$this->shipping_tax = 0;
|
'id' => $this->id,
|
||||||
$this->shipping_label = $this->title;
|
'label' => $this->title,
|
||||||
|
'cost' => 0,
|
||||||
|
'taxes' => array()
|
||||||
|
);
|
||||||
|
$this->add_rate( $args );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ class woocommerce_shipping {
|
||||||
var $shipping_methods = array();
|
var $shipping_methods = array();
|
||||||
var $chosen_method = null;
|
var $chosen_method = null;
|
||||||
var $shipping_total = 0;
|
var $shipping_total = 0;
|
||||||
var $shipping_tax = 0;
|
|
||||||
var $shipping_taxes = array();
|
var $shipping_taxes = array();
|
||||||
var $shipping_label = null;
|
var $shipping_label = null;
|
||||||
var $shipping_classes;
|
var $shipping_classes;
|
||||||
|
@ -51,11 +50,9 @@ class woocommerce_shipping {
|
||||||
ksort($this->shipping_methods);
|
ksort($this->shipping_methods);
|
||||||
|
|
||||||
add_action('woocommerce_update_options_shipping', array(&$this, 'process_admin_options'));
|
add_action('woocommerce_update_options_shipping', array(&$this, 'process_admin_options'));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_shipping_classes() {
|
function get_shipping_classes() {
|
||||||
|
|
||||||
if (!is_array($this->shipping_classes)) :
|
if (!is_array($this->shipping_classes)) :
|
||||||
|
|
||||||
$args = array(
|
$args = array(
|
||||||
|
@ -71,7 +68,6 @@ class woocommerce_shipping {
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_available_shipping_methods() {
|
function get_available_shipping_methods() {
|
||||||
|
|
||||||
if ($this->enabled=='yes') :
|
if ($this->enabled=='yes') :
|
||||||
|
|
||||||
$_available_methods = array();
|
$_available_methods = array();
|
||||||
|
@ -83,22 +79,8 @@ class woocommerce_shipping {
|
||||||
$shipping_method->calculate_shipping();
|
$shipping_method->calculate_shipping();
|
||||||
|
|
||||||
// If available, put available methods/rates in the array
|
// If available, put available methods/rates in the array
|
||||||
if ($shipping_method->multiple_rates) :
|
if (is_array($shipping_method->rates) && sizeof($shipping_method->rates) > 0) :
|
||||||
|
foreach ($shipping_method->rates as $rate) $_available_methods[$rate->id] = $rate;
|
||||||
foreach ($shipping_method->rates as $rate) :
|
|
||||||
|
|
||||||
$method = $rate;
|
|
||||||
|
|
||||||
$_available_methods[$method->id] = $method;
|
|
||||||
|
|
||||||
endforeach;
|
|
||||||
|
|
||||||
else :
|
|
||||||
|
|
||||||
$method = $shipping_method;
|
|
||||||
|
|
||||||
$_available_methods[$method->id] = $method;
|
|
||||||
|
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
endif;
|
endif;
|
||||||
|
@ -112,22 +94,17 @@ class woocommerce_shipping {
|
||||||
|
|
||||||
function reset_shipping_methods() {
|
function reset_shipping_methods() {
|
||||||
foreach ( $this->shipping_methods as $shipping_method ) :
|
foreach ( $this->shipping_methods as $shipping_method ) :
|
||||||
$shipping_method->shipping_total = 0;
|
|
||||||
$shipping_method->shipping_tax = 0;
|
|
||||||
$shipping_method->shipping_taxes = array();
|
|
||||||
$shipping_method->rates = array();
|
$shipping_method->rates = array();
|
||||||
endforeach;
|
endforeach;
|
||||||
}
|
}
|
||||||
|
|
||||||
function calculate_shipping() {
|
function calculate_shipping() {
|
||||||
|
|
||||||
if ($this->enabled=='yes') :
|
if ($this->enabled=='yes') :
|
||||||
|
|
||||||
$this->shipping_total = 0;
|
$this->shipping_total = 0;
|
||||||
$this->shipping_tax = 0;
|
|
||||||
$this->shipping_taxes = array();
|
$this->shipping_taxes = array();
|
||||||
$this->shipping_label = null;
|
$this->shipping_label = null;
|
||||||
$_cheapest_fee = '';
|
$_cheapest_cost = '';
|
||||||
$_cheapest_method = '';
|
$_cheapest_method = '';
|
||||||
if (isset($_SESSION['_chosen_shipping_method'])) $chosen_method = $_SESSION['_chosen_shipping_method']; else $chosen_method = '';
|
if (isset($_SESSION['_chosen_shipping_method'])) $chosen_method = $_SESSION['_chosen_shipping_method']; else $chosen_method = '';
|
||||||
$calc_cheapest = false;
|
$calc_cheapest = false;
|
||||||
|
@ -141,13 +118,10 @@ class woocommerce_shipping {
|
||||||
if (sizeof($_available_methods)>0) :
|
if (sizeof($_available_methods)>0) :
|
||||||
|
|
||||||
foreach ($_available_methods as $method_id => $method) :
|
foreach ($_available_methods as $method_id => $method) :
|
||||||
|
if ($method->cost < $_cheapest_cost || !is_numeric($_cheapest_cost)) :
|
||||||
$fee = $method->shipping_total;
|
$_cheapest_cost = $method->cost;
|
||||||
if ($fee < $_cheapest_fee || !is_numeric($_cheapest_fee)) :
|
|
||||||
$_cheapest_fee = $fee;
|
|
||||||
$_cheapest_method = $method_id;
|
$_cheapest_method = $method_id;
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
// Default to cheapest
|
// Default to cheapest
|
||||||
|
@ -156,24 +130,19 @@ class woocommerce_shipping {
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
if ($chosen_method) :
|
if ($chosen_method) :
|
||||||
|
|
||||||
$_SESSION['_chosen_shipping_method'] = $chosen_method;
|
$_SESSION['_chosen_shipping_method'] = $chosen_method;
|
||||||
$this->shipping_total = $_available_methods[$chosen_method]->shipping_total;
|
$this->shipping_total = $_available_methods[$chosen_method]->cost;
|
||||||
$this->shipping_tax = $_available_methods[$chosen_method]->shipping_tax;
|
$this->shipping_taxes = $_available_methods[$chosen_method]->taxes;
|
||||||
$this->shipping_taxes = $_available_methods[$chosen_method]->shipping_taxes;
|
$this->shipping_label = $_available_methods[$chosen_method]->label;
|
||||||
$this->shipping_label = $_available_methods[$chosen_method]->title;
|
|
||||||
|
|
||||||
endif;
|
endif;
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function reset_shipping() {
|
function reset_shipping() {
|
||||||
unset($_SESSION['_chosen_shipping_method']);
|
unset($_SESSION['_chosen_shipping_method']);
|
||||||
$this->shipping_total = 0;
|
$this->shipping_total = 0;
|
||||||
$this->shipping_tax = 0;
|
|
||||||
$this->shipping_taxes = array();
|
$this->shipping_taxes = array();
|
||||||
$this->shipping_label = null;
|
$this->shipping_label = null;
|
||||||
}
|
}
|
||||||
|
@ -193,5 +162,4 @@ class woocommerce_shipping {
|
||||||
|
|
||||||
update_option( 'woocommerce_shipping_method_order', $order );
|
update_option( 'woocommerce_shipping_method_order', $order );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -12,26 +12,54 @@
|
||||||
class woocommerce_shipping_method extends woocommerce_settings_api {
|
class woocommerce_shipping_method extends woocommerce_settings_api {
|
||||||
|
|
||||||
var $id;
|
var $id;
|
||||||
var $method_title;
|
var $method_title; // Method title
|
||||||
var $title;
|
var $title; // User set title
|
||||||
var $availability;
|
var $availability;
|
||||||
var $countries;
|
var $countries;
|
||||||
var $type;
|
var $type;
|
||||||
var $fee = 0;
|
var $fee = 0;
|
||||||
var $min_amount = null;
|
var $min_amount = null;
|
||||||
var $enabled = false;
|
var $enabled = false;
|
||||||
var $shipping_total = 0;
|
|
||||||
var $shipping_tax = 0;
|
/**
|
||||||
var $cost = 0; // Stores cost if theres only one
|
* Rates
|
||||||
var $multiple_rates = false;
|
*
|
||||||
var $rates = array(); // When a method has more than one cost/choice it will be in this array of titles/costs
|
* This is an array of rates - methods must populate this array to register shipping costs
|
||||||
|
*/
|
||||||
|
var $rates = array(); // This is an array of rates - methods must populate this array to register shipping costs
|
||||||
|
|
||||||
|
function add_rate( $args = array() ) {
|
||||||
|
$defaults = array(
|
||||||
|
'id' => '',
|
||||||
|
'label' => '',
|
||||||
|
'cost' => '0',
|
||||||
|
'taxes' => array()
|
||||||
|
);
|
||||||
|
|
||||||
|
$args = wp_parse_args( $args, $defaults );
|
||||||
|
|
||||||
|
extract( $args );
|
||||||
|
|
||||||
|
// Id and label are required
|
||||||
|
if (!$id || !$label) return;
|
||||||
|
|
||||||
|
$rate = new stdClass;
|
||||||
|
$rate->id = $id;
|
||||||
|
$rate->label = $label;
|
||||||
|
$rate->cost = $cost;
|
||||||
|
$rate->taxes = $taxes;
|
||||||
|
|
||||||
|
$this->rates[] = $rate;
|
||||||
|
}
|
||||||
|
|
||||||
function is_available() {
|
function is_available() {
|
||||||
global $woocommerce;
|
global $woocommerce;
|
||||||
|
|
||||||
if ($this->enabled=="no") return false;
|
if ($this->enabled=="no")
|
||||||
|
return false;
|
||||||
|
|
||||||
if (isset($woocommerce->cart->cart_contents_total) && isset($this->min_amount) && $this->min_amount && $this->min_amount > $woocommerce->cart->cart_contents_total) return false;
|
if (isset($woocommerce->cart->cart_contents_total) && isset($this->min_amount) && $this->min_amount && $this->min_amount > $woocommerce->cart->cart_contents_total)
|
||||||
|
return false;
|
||||||
|
|
||||||
$ship_to_countries = '';
|
$ship_to_countries = '';
|
||||||
|
|
||||||
|
|
16
readme.txt
16
readme.txt
|
@ -4,7 +4,7 @@ Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, store, sh
|
||||||
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=paypal@woothemes.com&item_name=Donation+for+WooCommerce
|
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=paypal@woothemes.com&item_name=Donation+for+WooCommerce
|
||||||
Requires at least: 3.3
|
Requires at least: 3.3
|
||||||
Tested up to: 3.3
|
Tested up to: 3.3
|
||||||
Stable tag: 1.3.2.1
|
Stable tag: 1.4
|
||||||
|
|
||||||
WooCommerce is an open-source e-commerce toolkit that helps you sell anything. Beautifully.
|
WooCommerce is an open-source e-commerce toolkit that helps you sell anything. Beautifully.
|
||||||
|
|
||||||
|
@ -84,6 +84,7 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo
|
||||||
|
|
||||||
= 1.4 =
|
= 1.4 =
|
||||||
* Support for multiple and stacked (compound) taxes
|
* Support for multiple and stacked (compound) taxes
|
||||||
|
* Locale options for country address formatting and checkout fields
|
||||||
* Multiple taxes shown in order total tables
|
* Multiple taxes shown in order total tables
|
||||||
* Rewritten parts + re-organised files for increased performance and decreased memory usage
|
* Rewritten parts + re-organised files for increased performance and decreased memory usage
|
||||||
* Moved many shortcodes (contents) to template files for easier customisation
|
* Moved many shortcodes (contents) to template files for easier customisation
|
||||||
|
@ -94,7 +95,6 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo
|
||||||
* Changed woocommerce_breadcrumb args
|
* Changed woocommerce_breadcrumb args
|
||||||
* Filters for customer email attachments
|
* Filters for customer email attachments
|
||||||
* Chosen selects for country/state select inputs (optional)
|
* Chosen selects for country/state select inputs (optional)
|
||||||
* Locale options for country address formatting and checkout fields
|
|
||||||
* Piwik (http://piwik.org/) tracking - requires http://wordpress.org/extend/plugins/wp-piwik/
|
* Piwik (http://piwik.org/) tracking - requires http://wordpress.org/extend/plugins/wp-piwik/
|
||||||
* Option to hide cart widget if the cart is empty
|
* Option to hide cart widget if the cart is empty
|
||||||
* Category widget - order by option
|
* Category widget - order by option
|
||||||
|
@ -113,6 +113,8 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo
|
||||||
* Enabled product custom fields panel
|
* Enabled product custom fields panel
|
||||||
* Renamed custom fields for product data - upgrade script will run when upgrading. Some themes may be affected if using 'featured' - it is now '_featured'
|
* Renamed custom fields for product data - upgrade script will run when upgrading. Some themes may be affected if using 'featured' - it is now '_featured'
|
||||||
* woocommerce_product_visibility_options filter for backend
|
* woocommerce_product_visibility_options filter for backend
|
||||||
|
* Shipping method classes/api changed to make rate definition simpler - shipping methods will need updating to stay compatible
|
||||||
|
* Change textdomain from woothemes to woocommerce
|
||||||
|
|
||||||
= 1.3.2.1 - 15/12/2011 =
|
= 1.3.2.1 - 15/12/2011 =
|
||||||
* Category/Ordering fix
|
* Category/Ordering fix
|
||||||
|
@ -404,7 +406,15 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo
|
||||||
== Upgrade Notice ==
|
== Upgrade Notice ==
|
||||||
|
|
||||||
= 1.4 =
|
= 1.4 =
|
||||||
Major update with plenty of optimisations and new features. Product data meta has been renamed in this version so that custom-fields can be enabled. Product data is now prepended with an underscore so they are hidden from the custom-field panel. Existing data will be upgraded automatically. Please backup your database before upgrading and also ensure you are running the latest versions of any WooCommerce plugins after upgrading.
|
Major update with plenty of optimisations and new features. Changed to note:
|
||||||
|
|
||||||
|
* Requires WP 3.3
|
||||||
|
* Product data meta has been renamed in this version so that custom-fields can be enabled. Product data is now prepended with an underscore so they are hidden from the custom-field panel. Existing data will be upgraded automatically.
|
||||||
|
* The shipping method classes have been updated to make rate definition easier. Third party plugins will need updating.
|
||||||
|
* Textdomain has changed - re-scan your po/mo's
|
||||||
|
* Tax additions (tax rows, compounds etc) required a change to the way order items are stored. Old orders won't show items when viewed. Order totals should be unaffected.
|
||||||
|
|
||||||
|
Please backup your database before upgrading and also ensure you are running the latest versions of any WooCommerce plugins after upgrading.
|
||||||
|
|
||||||
= 1.3 =
|
= 1.3 =
|
||||||
This is a major update and includes improvements to the tax and coupon system in particular - please backup your database before upgrading and also ensure you are running the latest versions of any WooCommerce plugins after upgrading.
|
This is a major update and includes improvements to the tax and coupon system in particular - please backup your database before upgrading and also ensure you are running the latest versions of any WooCommerce plugins after upgrading.
|
||||||
|
|
|
@ -43,21 +43,21 @@ $available_methods = $woocommerce->shipping->get_available_shipping_methods();
|
||||||
|
|
||||||
echo '<option value="'.esc_attr($method->id).'" ';
|
echo '<option value="'.esc_attr($method->id).'" ';
|
||||||
|
|
||||||
echo '<option value="'.$method->id.'" '.selected($method->id, $_SESSION['_chosen_shipping_method'], false).'>'.$method->title.' — ';
|
echo '<option value="'.$method->id.'" '.selected($method->id, $_SESSION['_chosen_shipping_method'], false).'>'.$method->label.' — ';
|
||||||
|
|
||||||
if ($method->shipping_total>0) :
|
if ($method->cost>0) :
|
||||||
|
|
||||||
if ($woocommerce->cart->display_totals_ex_tax || !$woocommerce->cart->prices_include_tax) :
|
if ($woocommerce->cart->display_totals_ex_tax || !$woocommerce->cart->prices_include_tax) :
|
||||||
|
|
||||||
echo woocommerce_price($method->shipping_total);
|
echo woocommerce_price($method->cost);
|
||||||
if ($method->shipping_tax>0 && $woocommerce->cart->prices_include_tax) :
|
if (array_sum($method->taxes)>0 && $woocommerce->cart->prices_include_tax) :
|
||||||
echo ' ' . $woocommerce->countries->ex_tax_or_vat();
|
echo ' ' . $woocommerce->countries->ex_tax_or_vat();
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
else :
|
else :
|
||||||
|
|
||||||
echo woocommerce_price($method->shipping_total + $method->shipping_tax);
|
echo woocommerce_price($method->cost + array_sum($method->taxes));
|
||||||
if ($method->shipping_tax>0 && !$woocommerce->cart->prices_include_tax) :
|
if (array_sum($method->taxes)>0 && !$woocommerce->cart->prices_include_tax) :
|
||||||
echo ' ' . $woocommerce->countries->inc_tax_or_vat();
|
echo ' ' . $woocommerce->countries->inc_tax_or_vat();
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue