Skip to content

Instantly share code, notes, and snippets.

@joshubrown
joshubrown / curl.txt
Created April 25, 2018 23:39
Create a zero-dollar recurring app charge with a capped amount using cURL
curl --request POST \
--url 'https://yourshop.myshopify.com/admin/recurring_application_charges.json' \
--header 'content-type: application/json' \
--header 'x-shopify-access-token: yourtoken' \
--data '{
"recurring_application_charge": {
"name": "Super Duper Plan",
"price": 0,
"capped_amount" : 10,
"terms": "test",
@joshubrown
joshubrown / sample.java
Created July 11, 2017 17:18
Getting product images URLs and variant prices with the Android Buy SDK
GraphClient graphClient = GraphClient.builder(this)
.shopDomain(BuildConfig.SHOP_DOMAIN)
.accessToken(BuildConfig.API_KEY)
.build();
ID id = new ID("Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0Lzk1OTAwMjcyNjY=");
Storefront.QueryRootQuery query = Storefront.query(rootQueryBuilder ->
rootQueryBuilder
.node(id, nodeQuery ->
nodeQuery
@joshubrown
joshubrown / variantCreate.php
Created August 7, 2015 17:04
Creating a product variant using PHP
<?php
$ch = curl_init("https://key:pass@appsrule.myshopify.com/admin/products/1075339140/variants.json");
$variant = json_encode(array('variant'=> array('option1' => 'test')));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $variant);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
$response = curl_exec($ch);
https://cdn.shopify.com/s/files/1/0926/8862/products/shopify-default-inverted_7879c2c1-9654-42ee-ae03-62c93edf2217.png?v=1438811403
https://cdn.shopify.com/s/files/1/0926/8862/products/shopify-default_b6afeb58-59e4-4cc4-a04d-b530f07e938b.png?v=1438811403
{% for address in customer.addresses %}
{% form 'customer_address', address %}
<table>
<tr>
<td class="label"><label for="address_first_name_{{form.id}}">First name</label></td>
<td class="value"><input type="text" id="address_first_name_{{form.id}}" class="address_form" name="address[first_name]" value="{{form.first_name}}" size="40" /></td>
</tr>
<tr>
<td class="label"><label for="address_address1_{{form.id}}">Address Line 1</label></td>
<td class="value"><input type="text" id="address_address1_{{form.id}}" class="address_form" name="address[address1]" value="{{form.address1}}" size="40" /></td>