Shoprocket - start selling online
No results found
| SDK Functions

SDK Functions

Updated on 2 January, 2025 in Javascript SDK
4,054 0 0

Note: By default, Shoprocket works automatically and handles most events & behaviours for you. The below functions are for advanced usage, in cases where you do not want to use our embeds or want to customise the behaviour.

This guide is designed to help you make the most of Shoprocket's software development kit (SDK) for cart management. Below, you'll find the essential functionalities you can leverage to manage Shoprocket within your application.

Table of Contents

  1. Adding an Item to the Cart
  2. Rendering an Abandoned Cart
  3. Updating Quantity of an Item in the Cart
  4. Removing an Item from the Cart
  5. Clearing the Cart
  6. Getting Cart Items
  7. Working with Session
  8. Populating the Cart Address
  9. Toggle the Cart (open/close)
  10. Set the Currency
  11. Set the Language
  12. Retrieve an Order

Listening for the Shoprocket Ready Event

Before using the Shoprocket SDK, it's essential to ensure that the SDK is fully loaded and ready to be used. To do this, you need to listen for the Shoprocket.ready event. Here's an example of how to listen for the event:

Adding an Item to the Cart

To add an item to the cart, you can use the Shoprocket.cart.add() method.

Rendering an Abandoned Cart

To recover an abandoned cart, utilise the Shoprocket.cart.recover method.

Updating Quantity of an Item in the Cart

The Shoprocket.cart.update method lets you update the quantity of an existing item in the cart.

Removing an Item from the Cart

To remove an item from the cart, you can call the Shoprocket.cart.remove method.

Clearing the Cart

If you wish to clear all items from the cart, the Shoprocket.cart.clear method comes in handy.

Getting Cart Items

To retrieve all items in the cart, use the Shoprocket.cart.get method.

Working with the Session

You can work with the Shoprocket Session (using local storage) to set & get custom values via Shoprocket.session.

Populating the Cart Address

If you already know your customer's details, you can automatically populate the cart address via Shoprocker.cart.address.

Toggle the Cart (open/close)

You can toggle the cart via the Shoprocket.cart.toggle() method.

Set Currency

You can switch between currencies via the following method:

Note: we detect visitor locale automatically via IP location and set their currency (if currency is enabled in store)

Set Language

You can switch between languages via the following method:

Note: we detect visitor locale automatically via IP location and set their language (if launguage is enabled in store)

Retrieve an Order

You can retrieve the details of an existing order using the order_id, this is ideal if you're using your own custom thank you page, and would like to display conditional content based on order items etc.

Was this article helpful?

Can't find what you're looking for?

Our support team are on hand to help with any questions you have.

Chat with us 👋
Good prices for a great product!
Shoprocket 5 star review
The product is great for integrating into your website. Functionality is good and they are constantly adding more features. The tiered pricing is very good and much less than other platforms.I faced s...
Amazing Support
Shoprocket 5 star review
The e-commerce platform is very good, could always do with improvements, but Ryan and the support team are amazing! Very quick to make updates, fix bugs etc and they reply to messages and questions ve...
Love using Shoprocket
Shoprocket 5 star review
Love using Shoprocket! Eshop is not my primary business, use it to sell merch as a support channel, and the easy with which I was able to add Shoprocket-powered eshop to my existing NextJS project is...
Highly recommended!!
Shoprocket 5 star review
I'm a small business owner who's not that experienced with most things tech related, started my website on carrd which I eventually learned, is not the best for hosting an ecommerce site or an...
100% worth the money
Shoprocket 5 star review
I love how modular Shoprocket is. As a headless ecommerce solution I can confidently configure knowing that if I ever change my website tech stack, I won't have to start over with my store.And as...
First-class service absolutely ALWAYS
Shoprocket 5 star review
First-class service absolutely ALWAYS and at anytime! Highly recommend it, they answered SO many questions for me, and 100% confidence these are the folks to use!
I like almost everything about Shoprocket
Shoprocket 5 star review
I like almost everything about Shoprocket. its easy to use and quick customer service. 10/10.
Shoprocket and it's founder always available for s
Shoprocket 5 star review
Shoprocket has been a trustworthy partner since I started to use it. It's been paramount for our growth in 2022 and 2023 and I am sure it will continue to.What really sets this software apart is t...
Great product and excellent customer service!
Shoprocket 5 star review
They have possibly the first service rep I have come across that will look at your problem and fix your code within few minutes to help with customising the integration of the shoprocket tool - massiv...
Brilliant company…
Shoprocket 5 star review
An amazing system for an online shop and what makes it better is the human contact that is available 24/7. Would highly recommend.
Easy to use with excellent support
Shoprocket 5 star review
I've saved a ton of time and avoided headaches by creating products in Shoprocket and integrating them on my website and sales pages. Whenever I have a question, they can usually resolve it via chat i...
One of the best ecommerce platforms and plugins!
Shoprocket 5 star review
One of the best ecommerce platforms that exist - i already had an existing site hosted elsewhere and this made it so easy for me to create my online store without paying the extra added cost that'...
Highly recommended
Shoprocket 5 star review
I am new to this game, but shoprocket has proven to be an easy to use product, that performs as advertised. The customer service is prompt, very friendly, and importantly, very knowledgeable. I have...
Excellent support
Shoprocket 5 star review
Im really enthusiastic about Shoprocket. It works super fast, the shop is easy to customise and the support is one of a kind, super fast and clear communication, I love it. They even added a word to t...
So easy to set up!!
Shoprocket 5 star review
So easy to set up, so responsive and helpful! Its been two weeks and a platform never been so easy!
Incredible, in-budget and speedy
Shoprocket 5 star review
Incredible and much cheaper than their competitors (Shopify, ECWID, etc). Too easy to setup. Amazingly speed too.
Very good online selling site.
Shoprocket 5 star review
This platform stands out as a straightforward and user-friendly online selling site. With easy setup procedures and a clean interface, it swiftly transforms a daunting task into a manageable one.
Extremely easy to setup
Shoprocket 5 star review
Extremely easy to setup and if you have a problem just use the chat button. I am across the world but Ryan was there in an instant with not only an answer but a quick video recording he made to show h...
I recently started using Shoprocket.io
Shoprocket 5 star review
I recently started using Shoprocket.io for my online store and I couldn't be happier! As a small business owner, I was looking for a platform that was both user-friendly and packed with all the fe...
We are loving Shoprocket
Shoprocket 5 star review
We are loving Shoprocket, the customer service has been fantastic and I love the flexibility and integration with our website host Showit. We are grateful to have found this!
A Customer Service Second to None!
Shoprocket 5 star review
I run a knowledge and educational website, and had always envisioned setting up a shop for digital educational products. However, not being adept at programming or development, and solely relying on t...
Excellent and versatile shop software
Shoprocket 5 star review
After searching for an easy to integrate shop system, I finally found Shoprocket. From the beginning, I was impressed by the easy integration of the individual products or the catalogue into an existi...
Best service ever
Shoprocket 5 star review
There's a lot of things you could say about Shoprocket, and I've got positive things to say about almost everything. But one thing is sure, and that is that Shoprocket have the best customer s...
Excellent solution and support!
Shoprocket 5 star review
We have been testing a lot of systems, and never found such a solid and intuitive system as Shoprocket. The support is outstanding, and the way they listen to us regarding implementing features etc, i...
Great shopping cart that integrates into your own
Shoprocket 5 star review
I really love Shoprockets shopping cart, it's just a simple code inserted into our own website. Ryan is absolutely fabulous with all his help to anything you need to know. If you want to keep ever...
Incredible customer service
Shoprocket 5 star review
Incredible customer service and refreshing to see a product with so many features that's so easy to use! Absolutely brilliant, can't recommend enough.
Service client excellent et très bonne
Shoprocket 5 star review
Service client excellent et très bonne solution ecommerce
Great customer service
Shoprocket 5 star review
Great customer service, willing to inform me when I have questions about how things are done to help make my business better.
Easy to use and great support
Shoprocket 5 star review
This was my first time building a store and I am amazed at how easy it has been. The tool is easy to navigate, it looks nice. Also, the integration with Stipe and my website on PageCloud couldn't...
Ryan is very attentive and when there…
Shoprocket 5 star review
Ryan is very attentive and when there were some issues it was addressed thank you shoprocket, things are great!
Always very helpful & informative
Shoprocket 5 star review
Always very helpful & informative whenever I’ve have a query. Replies are a lot quicker than my website provider & info is a lot clearer.
Reliable, Reactive and (I think) Revolutionary
Shoprocket 5 star review
I am a long term user of Shoprocket, not sure how long as its been across jobs and roles and projects but I am currently using it for taking payments for consultancy services. It is by far the easiest...
Very promising but... it works!
Shoprocket 5 star review
Very promising, and the price in very interesting. Now, after some email exchanges, all is updated and it works fine ! Very good and responsive support ! You have a new customer now.
Huge potential
Shoprocket 5 star review
Shoprocket is still in the start up process, as I see it, but it got huge potential. There are a few things that might need to be a bit better, e.g. the admin panel is not working perfectly in Google...
Great features, easy to use
Shoprocket 5 star review
Excellent customer service. Easy, straightforward interface, and an abundance of features at a very reasonable price.
Fills a gap in the market
Shoprocket 5 star review
Took me a while to find something that did what shoprocket did; which is surprising as it would seem to be an obvious and popular tool. v2 has had a few small bugs while it's brought up to speed b...
Great customer service
Shoprocket 5 star review
Great customer service
So much better than shopify
Shoprocket 5 star review
So much better than shopify, its super customizable, customer service is awesome and is flexible for any industry. Still in its developing phase but the at the rate its going in improvements, this is...
The speed of getting my problem solved…
Shoprocket 5 star review
The speed of getting my problem solved was so appreciated. And I am always treated very well, chat and or email! The lady who helps with my website also said to me Shoprocket has awesome customer serv...
Impressive
Shoprocket 5 star review
Although still in beta, Shoprocket is pretty impressive. The finished product is looking set to be an extremely useful and powerful tool for anyone selling anything online. And the customer service is...
Shoprocket is a Great system!
Shoprocket 5 star review
We have been using Shoprocket for at least 3 years now. This past May (2021) they released their latest version and it looks like a major rewrite. The product was good before, but now it's really...
User-friendly platform and excellent…
Shoprocket 5 star review
User-friendly platform and excellent customer service. I couldn't ask for a better tool!
Would highly recommend Ryan in…
Shoprocket 5 star review
Would highly recommend Ryan in Shoprocket. He is a credit to the team. Very helpful and efficient.
Shoprocket is perfect for new and existing web bus
Shoprocket 5 star review
Shoprocket was the best option for adding a shop to my existing website to enable me to sell and accept card payments and deposits for my bespoke products. It was fast to set up with clear menu option...
Very helpful account manager Ryan who…
Shoprocket 5 star review
Very helpful account manager Ryan who has guided me through any issues I had. Good platform that works very well.
Good prices for a great product!
Shoprocket 5 star review
The product is great for integrating into your website. Functionality is good and they are constantly adding more features. The tiered pricing is very good and much less than other platforms.I faced s...
Amazing Support
Shoprocket 5 star review
The e-commerce platform is very good, could always do with improvements, but Ryan and the support team are amazing! Very quick to make updates, fix bugs etc and they reply to messages and questions ve...
Love using Shoprocket
Shoprocket 5 star review
Love using Shoprocket! Eshop is not my primary business, use it to sell merch as a support channel, and the easy with which I was able to add Shoprocket-powered eshop to my existing NextJS project is...
Highly recommended!!
Shoprocket 5 star review
I'm a small business owner who's not that experienced with most things tech related, started my website on carrd which I eventually learned, is not the best for hosting an ecommerce site or an...
100% worth the money
Shoprocket 5 star review
I love how modular Shoprocket is. As a headless ecommerce solution I can confidently configure knowing that if I ever change my website tech stack, I won't have to start over with my store.And as...
First-class service absolutely ALWAYS
Shoprocket 5 star review
First-class service absolutely ALWAYS and at anytime! Highly recommend it, they answered SO many questions for me, and 100% confidence these are the folks to use!
I like almost everything about Shoprocket
Shoprocket 5 star review
I like almost everything about Shoprocket. its easy to use and quick customer service. 10/10.
Shoprocket and it's founder always available for s
Shoprocket 5 star review
Shoprocket has been a trustworthy partner since I started to use it. It's been paramount for our growth in 2022 and 2023 and I am sure it will continue to.What really sets this software apart is t...
Great product and excellent customer service!
Shoprocket 5 star review
They have possibly the first service rep I have come across that will look at your problem and fix your code within few minutes to help with customising the integration of the shoprocket tool - massiv...
Brilliant company…
Shoprocket 5 star review
An amazing system for an online shop and what makes it better is the human contact that is available 24/7. Would highly recommend.
Easy to use with excellent support
Shoprocket 5 star review
I've saved a ton of time and avoided headaches by creating products in Shoprocket and integrating them on my website and sales pages. Whenever I have a question, they can usually resolve it via chat i...
One of the best ecommerce platforms and plugins!
Shoprocket 5 star review
One of the best ecommerce platforms that exist - i already had an existing site hosted elsewhere and this made it so easy for me to create my online store without paying the extra added cost that'...
Highly recommended
Shoprocket 5 star review
I am new to this game, but shoprocket has proven to be an easy to use product, that performs as advertised. The customer service is prompt, very friendly, and importantly, very knowledgeable. I have...
Excellent support
Shoprocket 5 star review
Im really enthusiastic about Shoprocket. It works super fast, the shop is easy to customise and the support is one of a kind, super fast and clear communication, I love it. They even added a word to t...
So easy to set up!!
Shoprocket 5 star review
So easy to set up, so responsive and helpful! Its been two weeks and a platform never been so easy!
Incredible, in-budget and speedy
Shoprocket 5 star review
Incredible and much cheaper than their competitors (Shopify, ECWID, etc). Too easy to setup. Amazingly speed too.
Very good online selling site.
Shoprocket 5 star review
This platform stands out as a straightforward and user-friendly online selling site. With easy setup procedures and a clean interface, it swiftly transforms a daunting task into a manageable one.
Extremely easy to setup
Shoprocket 5 star review
Extremely easy to setup and if you have a problem just use the chat button. I am across the world but Ryan was there in an instant with not only an answer but a quick video recording he made to show h...
I recently started using Shoprocket.io
Shoprocket 5 star review
I recently started using Shoprocket.io for my online store and I couldn't be happier! As a small business owner, I was looking for a platform that was both user-friendly and packed with all the fe...
We are loving Shoprocket
Shoprocket 5 star review
We are loving Shoprocket, the customer service has been fantastic and I love the flexibility and integration with our website host Showit. We are grateful to have found this!
A Customer Service Second to None!
Shoprocket 5 star review
I run a knowledge and educational website, and had always envisioned setting up a shop for digital educational products. However, not being adept at programming or development, and solely relying on t...
Excellent and versatile shop software
Shoprocket 5 star review
After searching for an easy to integrate shop system, I finally found Shoprocket. From the beginning, I was impressed by the easy integration of the individual products or the catalogue into an existi...
Best service ever
Shoprocket 5 star review
There's a lot of things you could say about Shoprocket, and I've got positive things to say about almost everything. But one thing is sure, and that is that Shoprocket have the best customer s...
Excellent solution and support!
Shoprocket 5 star review
We have been testing a lot of systems, and never found such a solid and intuitive system as Shoprocket. The support is outstanding, and the way they listen to us regarding implementing features etc, i...
Great shopping cart that integrates into your own
Shoprocket 5 star review
I really love Shoprockets shopping cart, it's just a simple code inserted into our own website. Ryan is absolutely fabulous with all his help to anything you need to know. If you want to keep ever...
Incredible customer service
Shoprocket 5 star review
Incredible customer service and refreshing to see a product with so many features that's so easy to use! Absolutely brilliant, can't recommend enough.
Service client excellent et très bonne
Shoprocket 5 star review
Service client excellent et très bonne solution ecommerce
Great customer service
Shoprocket 5 star review
Great customer service, willing to inform me when I have questions about how things are done to help make my business better.
Easy to use and great support
Shoprocket 5 star review
This was my first time building a store and I am amazed at how easy it has been. The tool is easy to navigate, it looks nice. Also, the integration with Stipe and my website on PageCloud couldn't...
Ryan is very attentive and when there…
Shoprocket 5 star review
Ryan is very attentive and when there were some issues it was addressed thank you shoprocket, things are great!
Always very helpful & informative
Shoprocket 5 star review
Always very helpful & informative whenever I’ve have a query. Replies are a lot quicker than my website provider & info is a lot clearer.
Reliable, Reactive and (I think) Revolutionary
Shoprocket 5 star review
I am a long term user of Shoprocket, not sure how long as its been across jobs and roles and projects but I am currently using it for taking payments for consultancy services. It is by far the easiest...
Very promising but... it works!
Shoprocket 5 star review
Very promising, and the price in very interesting. Now, after some email exchanges, all is updated and it works fine ! Very good and responsive support ! You have a new customer now.
Huge potential
Shoprocket 5 star review
Shoprocket is still in the start up process, as I see it, but it got huge potential. There are a few things that might need to be a bit better, e.g. the admin panel is not working perfectly in Google...
Great features, easy to use
Shoprocket 5 star review
Excellent customer service. Easy, straightforward interface, and an abundance of features at a very reasonable price.
Fills a gap in the market
Shoprocket 5 star review
Took me a while to find something that did what shoprocket did; which is surprising as it would seem to be an obvious and popular tool. v2 has had a few small bugs while it's brought up to speed b...
Great customer service
Shoprocket 5 star review
Great customer service
So much better than shopify
Shoprocket 5 star review
So much better than shopify, its super customizable, customer service is awesome and is flexible for any industry. Still in its developing phase but the at the rate its going in improvements, this is...
The speed of getting my problem solved…
Shoprocket 5 star review
The speed of getting my problem solved was so appreciated. And I am always treated very well, chat and or email! The lady who helps with my website also said to me Shoprocket has awesome customer serv...
Impressive
Shoprocket 5 star review
Although still in beta, Shoprocket is pretty impressive. The finished product is looking set to be an extremely useful and powerful tool for anyone selling anything online. And the customer service is...
Shoprocket is a Great system!
Shoprocket 5 star review
We have been using Shoprocket for at least 3 years now. This past May (2021) they released their latest version and it looks like a major rewrite. The product was good before, but now it's really...
User-friendly platform and excellent…
Shoprocket 5 star review
User-friendly platform and excellent customer service. I couldn't ask for a better tool!
Would highly recommend Ryan in…
Shoprocket 5 star review
Would highly recommend Ryan in Shoprocket. He is a credit to the team. Very helpful and efficient.
Shoprocket is perfect for new and existing web bus
Shoprocket 5 star review
Shoprocket was the best option for adding a shop to my existing website to enable me to sell and accept card payments and deposits for my bespoke products. It was fast to set up with clear menu option...
Very helpful account manager Ryan who…
Shoprocket 5 star review
Very helpful account manager Ryan who has guided me through any issues I had. Good platform that works very well.
Add ecommerce to any website