Knowledge base | DonorShops.com

API: Add to Cart

Adds items to a cart. If a cart doesn't exist, it creates a cart.

Endpoint POST http://**yoursite**.donorshops.com/cart/add

Parameters

ParamTypeRequiredDescription
productinventoryid number Y The ID of the product variant being added to the cart.
qty number Y The qty of the item being added to the cart.
donation number N If the product is a donation, this is the amount of the donation.
productfields array N If you are passing in custom field data, this is an array of custom field values. Read More...
redirect_to string N The URL you want to redirect to after the item is added to the cart. By default, the checkout screen is loaded. If you are going to choose another page, we recommend using a page on your DS account and not on an external site. It may confuse the end user to land on a different website with no reference to their cart/donation.
recurring_day number N (1 to 31)
recurring_day_of_week number N (1 to 7)
recurring_frequency string N  
recurring_with_initial_charge number N 1 or 0 (Default 0)
is_tribute number N 1 or 0 (Default 0)
tribute_name string N The name on the Tribute/Dedication.
tribute_type_id number N The ID of the Tribute/Dedication type.
tribute_notify string N letter or email or  (blank)
tribute_notify_at date N The date the notification should be sent. (NOT SUPPORTED YET)
tribute_message string N A custom message to display on the dedication.
tribute_notify_name string N The name of the individual being notified.
tribute_notify_email string N The email of the individual being notified.
tribute_notify_address string N The mailing address of the individual being notified.
tribute_notify_city string N  
tribute_notify_state string N  
tribute_notify_zip string N  
tribute_notify_country string N  

Custom Fields productfields

productfields is a key/value array. The key should be the ID of the custom field. The value is the answer from the donor/customer.

Example:

If you had a custom field labelled "Why do you want to sign-up?" that had an ID of 73, the HTML Input might look like this:

<input name="productfields[73]" value="" />

To find the custom field ID, find the related product in your control panel and click to the details screen. Click on the Custom Fields tab, then look for the small grey ID reference in the bottom right corner of each custom field's panel.