id = 'flat_rate'; $this->method_title = __('Flat rate', 'woothemes'); $this->enabled = get_option('woocommerce_flat_rate_enabled'); $this->title = get_option('woocommerce_flat_rate_title'); $this->availability = get_option('woocommerce_flat_rate_availability'); $this->countries = get_option('woocommerce_flat_rate_countries'); $this->type = get_option('woocommerce_flat_rate_type'); $this->tax_status = get_option('woocommerce_flat_rate_tax_status'); $this->cost = get_option('woocommerce_flat_rate_cost'); $this->fee = get_option('woocommerce_flat_rate_handling_fee'); add_action('woocommerce_update_options_shipping_methods', array(&$this, 'process_admin_options')); add_option('woocommerce_flat_rate_availability', 'all'); add_option('woocommerce_flat_rate_title', 'Flat Rate'); add_option('woocommerce_flat_rate_tax_status', 'taxable'); } function calculate_shipping() { global $woocommerce; $_tax = &new woocommerce_tax(); $this->shipping_total = 0; $this->shipping_tax = 0; if ($this->type=='order') : // Shipping for whole order $this->shipping_total = $this->cost + $this->get_fee( $this->fee, $woocommerce->cart->cart_contents_total ); if ( get_option('woocommerce_calc_taxes')=='yes' && $this->tax_status=='taxable' ) : $rate = $_tax->get_shipping_tax_rate(); if ($rate>0) : $tax_amount = $_tax->calc_shipping_tax( $this->shipping_total, $rate ); $this->shipping_tax = $this->shipping_tax + $tax_amount; endif; endif; else : // Shipping per item if (sizeof($woocommerce->cart->get_cart())>0) : foreach ($woocommerce->cart->get_cart() as $item_id => $values) : $_product = $values['data']; if ($_product->exists() && $values['quantity']>0) : $item_shipping_price = ($this->cost + $this->get_fee( $this->fee, $_product->get_price() )) * $values['quantity']; // Only count 'psysical' products if ( $_product->needs_shipping() ) : $this->shipping_total = $this->shipping_total + $item_shipping_price; if ( $_product->is_shipping_taxable() && $this->tax_status=='taxable' ) : $rate = $_tax->get_shipping_tax_rate( $_product->get_tax_class() ); if ($rate>0) : $tax_amount = $_tax->calc_shipping_tax( $item_shipping_price, $rate ); $this->shipping_tax = $this->shipping_tax + $tax_amount; endif; endif; endif; endif; endforeach; endif; endif; } function admin_options() { global $woocommerce; ?>

countries->countries; asort($countries); $selections = get_option('woocommerce_flat_rate_countries', array()); ?>

    $val) : echo '
  • '; endforeach; ?>