Free shipping above a given amount

Hi,

How to pass cart total (with tax) and currency_code to shipping module? I've tried to do this the same way as in payment modules (global $order; $order->data['order_total'] ...) but it seems it does not work :/
I would like to get something like this:

$cost = $this->settings['weight_rate_table_1']; // this is only price
if(($order->data['currency_code']=='PLN')&&($order->data['order_total']>100)) $cost = 0;

Greetings,
ins

This is how the method is called:
$module->options($items, $subtotal, $tax, $currency_code, $customer);

This is how it is declared:
public function options($items, $subtotal, $tax, $currency_code, $customer) {

The order, including payment fees is yet not created in the shipping select process.

However, the order object is defined in after_process() by $GLOBALS['order']->data['param']. Will be changed in the future.

My solution:

$str = currency::format(cart::$data['total']['value'] + cart::$data['total']['tax']);
$var = filter_var($str,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);

if($var > 100) {
$cost = 0;
} else {
$cost = $this->settings['weight_rate_table_1'];
}

...i put this code in desired shipping module, right before:

$options[] = array(...

...and then in this options i put 'cost' => $cost instead 'cost' => $this->settings['weight_rate_table_1']

Dieses Thema wurde wegen langer Inaktivität geschlossen. Das Posten von Beiträgen ist nicht möglich.
View code on GitHub