You appear to be a bot. Output may be restricted
Description
Calculate shipping ratesCalculates a single shipping rate for the FREE version
Usage
OIK_Weight_Zone_Shipping::calculate_shipping( $package );
Parameters
- $package
- ( array ) optional –
Returns
voidSource
File name: oik-weight-zone-shipping/class-oik-weight-zone-shipping.phpLines:
1 to 27 of 27
function calculate_shipping( $package = array() ) { $this->contents_cost( $package['contents_cost'] ); $woocommerce = function_exists('WC') ? WC() : $GLOBALS['woocommerce']; $rates = $this->get_rates(); bw_trace2( $rates, "rates" ); $weight = $woocommerce->cart->cart_contents_weight; //bw_trace2( $weight, "cart contents weight" ); $final_rate = $this->pick_smallest_rate( $rates, $weight ); if ( $final_rate !== false && is_numeric( $final_rate )) { $taxable = ($this->tax_status == 'taxable') ? true : false; if ( $package['destination']['country'] ) { $final_rate += $this->handling_fee(); } $rate = array( 'id' => $this->id . "_" . $this->instance_id, 'label' => $this->shippingrate_title, 'cost' => $final_rate, 'taxes' => '', 'calc_tax' => 'per_order' ); //bw_trace2( $rate, "rate" ); $this->add_rate( $rate ); } else { add_filter( "woocommerce_cart_no_shipping_available_html", array( $this, 'no_shipping_available') ); } }View on GitHub View on Trac