So I know how to go about adding an item to the cart with PHP like this;
$product_nid = 2;
$some_data = NULL;
uc_cart_empty(uc_cart_get_id());
$data = serialize($some_data);
uc_cart_add_item($product_nid, $qty = 1, $data, $cid = NULL, $msg = TRUE, $check_redirect = TRUE, $rebuild = TRUE);
but I'm uncertain how to add a product with a certain attribute/option such as if I have product "A" with options "1" and "2" I was hoping I could get a little help. This is for Drupal 7, Ubercart 3.
$product_nid = 2; $some_data = array( 'attributes' => array( '1' => '1', ), ); uc_cart_empty(uc_cart_get_id()); $data = serialize($some_data); uc_cart_add_item($product_nid, $qty = 1, $data, $cid = NULL, $msg = TRUE, $check_redirect = TRUE, $rebuild = TRUE);