You are here

function commerce_wishlist_commerce_cart_product_add in Commerce Wishlist 7

Implements hook_commerce_cart_product_add().

File

./commerce_wishlist.module, line 69
Provides the wishlist for use in Drupal Commerce.

Code

function commerce_wishlist_commerce_cart_product_add($order, $product, $quantity, $line_item) {

  // When add product to cart delete product from wishlist if the configuration
  // is set to do so.
  if (variable_get('commerce_wishlist_remove_product', 1)) {
    db_delete('commerce_wishlist')
      ->condition(db_and()
      ->condition('uid', $order->uid)
      ->condition('product_id', $product->product_id))
      ->execute();
  }
}