Connecting to Shopify without an app

A reader reached out with a question for me about building a Shopify App:

I tried to find out if there was a way to directly connect to a single store without going the app route but I couldn't figure out how to do so.

This question is pretty common, especially for stores or integrations that aren't expecting to do a lot with Shopify. Their concern is that building an entire application just to do one thing or to get one piece of data sounds like too much.

Apps are simpler than you think

The fear comes from how Shopify has used the "app" label, especially in the Public App Store. Some apps are full web applications with multiple large features built by a team of developers. Other apps are smaller, one or two featured web applications that were built in a week or so.

Once you look outside of the App Store though, another definition of apps emerges.

An "app" is just a piece of code that connects to Shopify. The term Shopify App just means Shopify API Integration.

I've worked on large Shopify apps for clients that have serviced thousands of stores. I've also created simple scripts that have only ever connected to a single store in Shopify just to automate a single task.

For example, this script uses the private app authentication, runs from the command-line, and will tag repeat customers in a store.

App to tag customers

#!/usr/bin/env ruby require 'pry' require 'shopify_api' require 'dotenv' Dotenv.load

class TagCustomers attr_accessor :shop_url

Configure the Shopify connection

def initialize @shop_url = "https://#{ENV["SHOPIFY_API_KEY"]}:#{ENV["SHOPIFY_PASSWORD"]}@#{ENV["SHOP"]}" = @shop_url end

Tests the Shopify connection with a simple GET request

def test_connection return ShopifyAPI::Shop.current end

Downloads the customers from Shopify

def customers ShopifyAPI::Customer.all end

Tags repeat customers with the tag "repeat"

def tag_repeat_customers tagged_customers = [] customers.each do |customer| if customer.orders_count > 1 unless customer.tags.include?("repeat") customer.tags += "repeat" end tagged_customers << customer end end


end end

Called when the file is run on the command line, but not in a require

if __FILE__ == $PROGRAM_NAME tagged = puts "Tagged #{tagged.length} customers with 'repeat'" end

I have another app that is just a script to create a bunch of orders, customers, and products so there's data in the store for testing.

You don't need a fully built web application to connect to Shopify and use their APIs. You just need to follow the Shopify API documentation for authenticating your "app" and then you're good to go.

Would you like to learn how to improve your store, attract happy customers, and sell more products?

Learn how in the Shopify Dispatch.

Shopify Dispatch is a weekly curated newsletter with links and resources for Shopify merchants about Shopify and ecommerce.

We won't send you spam. Unsubscribe at any time. Powered by ConvertKit

Topics: Private app Private app authentication Shopify authentication Shopify development

Would you like a daily tip about Shopify?

Each tip includes a way to improve your store: customer analysis, analytics, customer acquisition, CRO... plus plenty of puns and amazing alliterations.