Tag: add
Ubercart API – Add to Cart with Attributes
I had a problem with that and finally I have found solution for that – it is very simple.
1 2 3 4 |
$product_id = 100; // this is your product id, in drupal it is node with product type $quantity = 1; // amount of product uc_cart_add_item($product_id, $quantity, array('attributes' => array(1 => 500)), NULL, NULL, $check_redirect = FALSE); ?> |
And the third parameter concerns attributes, the key of that array it is the first attribute on list of attributes in UbertCart control panel.