Function __global->calculate_shipping_cost

Definitions

sources/ecommerce_shipping.php

  • Recalculate shipping cost based on customer context.Does not handle multiple quantities or items, this is complex in itself (due to dimension merging) and handled in derive_cart_amounts.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: float

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$details ?array No No required parameter N/A N/A Map of product details (null: not for a final sold product, some kind of intermediate stage or peripheral check)
$shipping_cost ?REAL No No required parameter N/A N/A The default shipping cost (null: unknown)
&$product_weight ?float Yes No required parameter N/A N/A Weight of product (null: unknown)
&$product_length ?float Yes No required parameter N/A N/A Length of product (null: unknown)
&$product_width ?float Yes No required parameter N/A N/A Width of product (null: unknown)
&$product_height ?float Yes No required parameter N/A N/A Height of product (null: unknown)
$member_id ?MEMBER No No Null N/A N/A The member this is for (null: current member)

Returns

  • The shipping cost
  • Type: REAL
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Recalculate shipping cost based on customer context.Does not handle multiple quantities or items, this is complex in itself (due to dimension merging) and handled in derive_cart_amounts.
 *
 * @param  ?array $details Map of product details (null: not for a final sold product, some kind of intermediate stage or peripheral check)
 * @param  ?REAL $shipping_cost The default shipping cost (null: unknown)
 * @param  ?float $product_weight Weight of product (null: unknown)
 * @param  ?float $product_length Length of product (null: unknown)
 * @param  ?float $product_width Width of product (null: unknown)
 * @param  ?float $product_height Height of product (null: unknown)
 * @param  ?MEMBER $member_id The member this is for (null: current member)
 * @return REAL The shipping cost
 */

function calculate_shipping_cost(?array $details, ?float $shipping_cost, ?float &$product_weight, ?float &$product_length, ?float &$product_width, ?float &$product_height, ?int $member_id = null) : float