lucidnz / bootstrapify-1

An open-source base theme for Shopify using Twitter Bootstrap
http://bootstrapify-theme.myshopify.com/
187 stars 72 forks source link

Unable to use Shopify.clear() JavaScript function #236

Closed tagsmith closed 9 years ago

tagsmith commented 9 years ago

I'm trying to clear cart with Ajax.

When I run Shopify.clear in Browser console, I get undefined ... the output should instead be a function.

https://www.dropbox.com/s/8flf7ey2hiubi7r/Screenshot%202015-07-28%2011.17.19.png?dl=0

stewartknapman commented 9 years ago

What you are trying to run is a method, not a property, so you need to write Shopify.clear() note the parentheses.

However, and more importantly, there is no clear method, or any ajax methods exposed on the Shopify object like this, so calling this won't actually do anything.

You could look at CartJS (http://cartjs.org/), which is a Javascript library that you can use to interact with Shopifys cart api via ajax, but it is not included as part of Bootstrapify.

Hope this helps.

anikets commented 9 years ago

I was expecting Shopify.clear to output function body in console.

Thanks for pointing me to CartJS ... looks helpful.