Skip to content

Commit

Permalink
merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejolley committed Jan 11, 2016
1 parent 1076854 commit aae9561
Showing 1 changed file with 0 additions and 43 deletions.
43 changes: 0 additions & 43 deletions includes/class-wc-shipping.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,49 +172,6 @@ public function unregister_shipping_methods() {
$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.
*
Expand Down

0 comments on commit aae9561

Please sign in to comment.