merge conflict

This commit is contained in:
Mike Jolley 2016-01-11 11:49:02 +00:00
parent 1076854608
commit aae956185e
1 changed files with 0 additions and 43 deletions

View File

@ -172,49 +172,6 @@ class WC_Shipping {
$this->shipping_methods = array(); $this->shipping_methods = array();
} }
/**
<<<<<<< HEAD
* Returns all registered shipping methods.
=======
* Sort shipping methods.
*
* Sorts shipping methods into the user defined order.
*
* @return array
*/
public function sort_shipping_methods() {
$sorted_shipping_methods = array();
// Get order option
$ordering = (array) get_option('woocommerce_shipping_method_order');
$order_end = 999;
// Load shipping methods in order
foreach ( $this->shipping_methods as $method ) {
if ( isset( $ordering[ $method->id ] ) && is_numeric( $ordering[ $method->id ] ) ) {
// Add in position
$sorted_shipping_methods[ $ordering[ $method->id ] ][] = $method;
} else {
// Add to end of the array
$sorted_shipping_methods[ $order_end ][] = $method;
}
}
ksort( $sorted_shipping_methods );
$this->shipping_methods = array();
foreach ( $sorted_shipping_methods as $methods )
foreach ( $methods as $method ) {
$id = empty( $method->instance_id ) ? $method->id : $method->instance_id;
$this->shipping_methods[ $id ] = $method;
}
return $this->shipping_methods;
}
/** /**
* Returns all registered shipping methods for usage. * Returns all registered shipping methods for usage.
* *