Drupal 7 Ubercart programmatically add to cart product

Today we are learning about how to add the product to cart programmatically using Ubercart on Drupal 7. Let’s see we can add the product to cart using uc_cart_add_item function like.

uc_cart_add_item($nodeId, 1, array());

Using above function we can add the product to cart. The first argument is the “node id” and the second argument is the quantity of the product.

If you face any issue write the comment below.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s