Skip to content

Add product to cart through Code [drupal]

function add_products_to_cart ($sku, $qty) {

	$form_state = array(
			'values' => array(
					'nid' => $nid,
					'qty' => 1,
			),
	);
	$node = node_load($nid);
	drupal_execute("uc_product_add_to_cart_form", $form_state, $node);
}

Leave a Reply

Your email address will not be published.