You are here

function commerce_cart_user_login in Commerce Core 7

Same name and namespace in other branches
  1. 8.2 modules/cart/commerce_cart.module \commerce_cart_user_login()

Implements hook_user_login().

When a user logs into the site, if they have a shopping cart order it should be updated to belong to their user account.

File

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

Code

function commerce_cart_user_login(&$edit, $account) {

  // Get the user's anonymous shopping cart order if it exists.
  if ($order = commerce_cart_order_load()) {

    // Convert it to an authenticated cart.
    commerce_cart_order_convert($order, $account);
  }
}