No replies
fender177's picture
Offline
Joined: 07/28/2009
Juice: 35
Was this information Helpful?

Hello,

I am setting up a site that uses a custom module for adding products to the cart. It appears that items added to the cart with this custom module are not being shown as shippable.

When I take a look at the uc_cart_products table, the data for a product added without using the custom module appears like this:

a:3:{s:10:"attributes";a:0:{}s:9:"shippable";s:1:"1";s:6:"module";s:10:"uc_product";}

Whereas, products added to the cart with the custom module don't include the shippable piece of information.

a:3:{s:23:"order_product_design_id";s:3:"270";s:10:"attributes";a:1:{i:3;i:72;}s:6:"module";s:10:"uc_product";}

I've double checked, and the product has the shippable checkbox checked.

Does anyone have any thoughts on why this might be? It'd be great to know how to fix this as well.

Any help is greatly appreciated!

EDIT:
To solve the problem, in the custom module, just before the call to uc_cart_add_item(), I manually set the shippable flag to true with the following code:
$itemdata['shippable'] = 1;
$itemdata is passed to the uc_cart_add_item() function as the $data argument. Of course, if you have products that are non-shippable in your carts, you will have to put in a check of some sort. In the case of this catalog, all products are shippable.