You are here

public function CommerceShippingQuote::calculate_quote in Commerce Shipping 7

Do the actual shipping cost calculation.

Parameters

$currency_code: The currency code that the shipping should use when returning the cost.

$form_values: Array of values inputted in the submit form by the user.

$order: The order for which operations should be done.

$pane_form: The complete form array of the pane that shipping method is located on.

$pane_values: The complete $form_state of the pane that shipping method is located on.

Return value

array of values, one for each line item created containing one of.

  • (array) containing any of these keys: 'amount', 'currency_code', 'quantity', 'label'
  • (int) the price of the shipping, the order currency will be used, formatted as integer.

Overrides CommerceShippingQuoteInterface::calculate_quote

1 method overrides CommerceShippingQuote::calculate_quote()
CommerceShippingExample::calculate_quote in modules/plugins/quotes/example_plugin/CommerceShippingExample.class.php
Calculate quote callback: the bulk of the shipping method is usually found here. This is where we do the actual calculations to figure out what the shipping costs should be. We can return a single price or for more control an array of arrays containing:

File

plugins/quotes/quote_base/CommerceShippingQuote.class.php, line 120
Contains the CommerceShippingQuote class and CommerceShippingQuoteInterface interface.

Class

CommerceShippingQuote

Code

public function calculate_quote($currency_code, $form_values = array(), $order = NULL, $pane_form = NULL, $pane_values = NULL) {
}