Skip to content

Instantly share code, notes, and snippets.

@myjanky
Last active March 11, 2024 17:46
Show Gist options
  • Save myjanky/547b46be893f3cd6c62b077027cb3122 to your computer and use it in GitHub Desktop.
Save myjanky/547b46be893f3cd6c62b077027cb3122 to your computer and use it in GitHub Desktop.
Shopify store data widget
by Larry Wheeler
# Description
Widget for [Dashing](http://dashing.io/) that shows data from your Shopify shop.
# Usage
1. To use this widget, copy `shopify.html`, `shopify.coffee`, and `shopify.scss` into a `/widgets/shopify` directory, and copy the `shopify.rb` file into your `/jobs` folder.
2. Create a private app in your store and copy the secret and login. https://docs.shopify.com/api/guides/api-credentials
3. Add gem 'shopify_api', :require => 'shopify_api' to your Gemfile 'gem install shopify_api'
To include the widget in a dashboard, add the following snippet to the dashboard layout file:
```html
<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
<div data-id="shopify" data-view="Shopify" data-title="Shopify" style="background-color:#47bbb3;"></div>
<i class="icon-shopping-cart icon-background"></i>
</li>
```
.widget-shopify {
}
<h1 class="title" data-bind="title"></h1>
<h4>
Open Orders count
</h4>
<div data-bind="value"></div>
<p class="more-info" data-bind="moreinfo"></p>
<p class="updated-at" data-bind="updatedAtMessage"></p>
require 'shopify_api'
login = ''
secret = ''
shop = ''
shop_url = "https://" + login + ":" + secret + "@" + shop + ".myshopify.com/admin"
ShopifyAPI::Base.site = shop_url
shop = ShopifyAPI::Shop.current
SCHEDULER.every '30s', :first_in => 0 do |job|
# /admin/orders/count.json
orderCount = ShopifyAPI::Order.count()
send_event('shopify', {value: orderCount})
end
@MrPauls
Copy link

MrPauls commented Jul 19, 2016

Possible to get the coffee file added?

@applesolutions
Copy link

Possible to get the coffee file added?

Did u get it ?? Im not able to view data :(

@djeepgu
Copy link

djeepgu commented Dec 23, 2020

is this still maintained?

@franklineng
Copy link

franklineng commented May 3, 2021

Hi, is it possible to get a copy of the coffee file please? Would love to have Smashing showing Shopify stats on my dashboard.

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