Skip to content

Instantly share code, notes, and snippets.

@rsanchez
Created March 8, 2012 15:39
Show Gist options
  • Save rsanchez/2001555 to your computer and use it in GitHub Desktop.
Save rsanchez/2001555 to your computer and use it in GitHub Desktop.
CartThrob forms JSON response
//successful form submission
{
"success": 1,
"errors": {},
"return": "http://yoursite.com/path/to",
"XID": "0394wjg0w9rj0e65gmaode509gj095e", //only if secure forms is turned on
"cart_total": 100,
"cart_subtotal": 80,
"cart_discount": 0,
"cart_tax": 10,
"cart_shipping": 10
}
//failed form submission
{
"success": 0,
"errors": {
0: "This item is out of stock",
"title": "You must submit a title"
},
"return": "http://yoursite.com/path/to",
"XID": "0394wjg0w9rj0e65gmaode509gj095e" //only if secure forms is turned on
}
@bellamystudio
Copy link

Returning total_items_count would be really useful here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment