User Guide | Shipping Helper Data

Helper functions are used to provide value formatting and calculation functionality, or to return data from the carts database tables.

The functions can act independently of data within the cart session, using database table ids or custom data directly submitted to the function to return values, rather than for example requiring the row id of an item in the cart.

This independence from data within the cart session means the functions can be used on pages across a site that do not display cart data, or even on items that have not been added to the cart.

Shipping Helper Functions

Shipping Function Index | Shipping Config | Get Shipping Session Data | Set Shipping Session Data | Shipping Admin Data
Get Shipping Data from Database

get_shipping_options()

Help with Helper Functions

Show / Hide Help

Name: The name of the function (method).

Data Type: The data type that is expected by the function.

  • bool : Requires a boolean value of 'TRUE' or 'FALSE'.
  • string : Requires a textual value.
  • int : Requires a numeric value. It does not matter whether the value is an integer, float, decimal etc.
  • array : Requires an array.

Required: Defines whether the parameter requires a value to be submitted.

Default: Defines the default parameter value that is used if no other value is submitted.

get_shipping_options()

Looks-up the shipping tables and returns an array of available shipping options.


Library and Requirements

Available via the standard library only.

Requires the shipping database tables to be enabled.

How it Works

The function queries the shipping tables for all shipping options that match the carts current shipping location, and that have a shipping rate tier that matches the current weight and total value of the cart.

The returned array of shipping options can then typically be used to populate a html form element (i.e. select, radio etc).

Return Values

Failure:FALSE | An error message will be set if a required table/feature is disabled.

Success:multi-dimensional array

Example
$this->flexi_cart->get_shipping_options();

// Produces a multi-dimensional array like:
Array
(
[0] => Array
	(
		[id] => 1
		[name] => UK Standard Shipping
		[description] => 2-3 Days
		[value] => 3.95
		[tax_rate] => 
	)
[1] => Array
	(
		[id] => 2
		[name] => UK Recorded Shipping
		[description] => 2-3 Days
		[value] => 5.10
		[tax_rate] => 
	)
)