You are here

function commerce_cart_get_provider in Commerce Core 7

Returns the instantiated cart provider.

4 calls to commerce_cart_get_provider()
commerce_cart_order_session_delete in modules/cart/commerce_cart.module
Deletes all order IDs or a specific order ID from the cart orders session variable.
commerce_cart_order_session_exists in modules/cart/commerce_cart.module
Checks to see if any order ID or a specific order ID exists in the session.
commerce_cart_order_session_order_ids in modules/cart/commerce_cart.module
Returns an array of cart order IDs stored in the session.
commerce_cart_order_session_save in modules/cart/commerce_cart.module
Saves an order ID to the appropriate cart orders session variable.

File

modules/cart/commerce_cart.module, line 2964
Implements the shopping cart system and add to cart features.

Code

function commerce_cart_get_provider($provider = NULL) {
  ctools_include('plugins');
  if (empty($provider)) {
    $provider = variable_get('commerce_cart_provider', COMMERCE_CART_DEFAULT_PROVIDER);
  }

  // Return NULL if the class could not be found.
  if (!($class = ctools_plugin_load_class('commerce_cart', 'cart_provider', $provider, 'class'))) {
    return NULL;
  }
  return new $class();
}