When an anonymous user adds a coupon code to his cart and logs in afterwards, the system tries to merge the anonymous cart with the user cart. Because the coupon code isn't a product(node), the cart module gives the error "is not a product. Unable to add to cart".

Comments

panditvarun20’s picture

Issue summary: View changes

I am having the same issues.

hoangd’s picture

Bug at uc_cart.module line 1141
because Coupon code must not be a Product.
/**
* Adds an item to a user's cart.
*/
function uc_cart_add_item($nid, $qty = 1, $data = NULL, $cid = NULL, $msg = TRUE, $check_redirect = TRUE, $rebuild = TRUE) {
if (!uc_product_is_product($node->type)) {
..............
drupal_set_message(t('@title is not a product. Unable to add to cart.', array('@title' => $node->title)), 'error');
return;
}

nnason’s picture

Having this problem as well. Has anyone created a fix for it?

bharat.kelotra’s picture

Title: "is not a product. Unable to add to cart" » "is not a product. Unable to add to cart" - Fixed
Version: 7.x-2.1-alpha7 » 7.x-3.x-dev
StatusFileSize
new591 bytes

Actually when an anonymous user applies a coupon code and then login, a hook_user_login in uc_cart.module is called which adds all the cart item to the authenticated user's cart. In the process it uses a function to add item to cart which checkes the node id of each item. As the coupon is not a node which have a node id 0 so it gives a error that is not a product. Unable to add to cart.

I have fixed this issue. I am uploading a patch for this issue.

bharat.kelotra’s picture

Status: Active » Reviewed & tested by the community

Changing status.