Skip to content

Instantly share code, notes, and snippets.

@remy727
Created November 23, 2023 14:16
Show Gist options
  • Save remy727/75ef372eae9e3b1f4a134473ae3d11ef to your computer and use it in GitHub Desktop.
Save remy727/75ef372eae9e3b1f4a134473ae3d11ef to your computer and use it in GitHub Desktop.
Shopify REST Admin API Example
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "rails"
gem "shopify_api"
end
test_session = ShopifyAPI::Auth::Session.new(
shop: your_shop,
access_token: your_access_token,
)
client = ShopifyAPI::Clients::Rest::Admin.new(session: test_session)
body = {
variant: {
cost: 4.50
}
}
response = client.put(path: "variants/#{your_variant_id}.json", body: body)
puts response.body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment