This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
time_namelookup: 0.326604s | |
time_connect: 0.467748s | |
time_appconnect: 0.000000s | |
time_pretransfer: 0.467986s | |
time_redirect: 0.000000s | |
time_starttransfer: 0.584812s | |
---------- | |
time_total: 0.584852s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
time_namelookup: %{time_namelookup}s\n | |
time_connect: %{time_connect}s\n | |
time_appconnect: %{time_appconnect}s\n | |
time_pretransfer: %{time_pretransfer}s\n | |
time_redirect: %{time_redirect}s\n | |
time_starttransfer: %{time_starttransfer}s\n | |
----------\n | |
time_total: %{time_total}s\n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
destination_address: { | |
country_code: "CA", | |
province_code: "QC", | |
city: "Montreal", | |
address1: "address 1", | |
address2: "address 2", | |
address3: "address 3", | |
postal_code: "K2K2K2" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use an array to keep track of the discount campaigns desired. | |
CAMPAIGNS = [ | |
# $5 off all items with the "sale" tag | |
ItemCampaign.new( | |
AndSelector.new( | |
TagSelector.new("sale"), | |
ExcludeGiftCardSelector.new, | |
), | |
MoneyDiscount.new(5_00, "5$ off all items on sale",), | |
), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def Shopify.set_product_metafield_map(id, namespace, key, map) | |
# convert the map to JSON so it fits in one metafield | |
data = { | |
"metafield" => { | |
"namespace" => namespace, | |
"key" => key, | |
"value" => map.to_json, | |
"value_type" => "string" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################ | |
# Buy set, get X% off discount script. | |
# | |
# This script allows the running of a campaign to give customers X% off a "set" | |
# of items, if and only if they purchase at least one of each item in the set. | |
# | |
# The discount is applied only to all items in the set in the cart. | |
# | |
# Written by Gavin Ballard (gavin@discolabs.com) | |
################################################################################ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Input.cart.line_items.each do |line_item| | |
product = line_item.variant.product | |
next if product.gift_card? | |
next unless product.id == 6323295239 | |
line_item.change_line_price(line_item.line_price * 0.90, message: "My Sale") | |
end | |
Output.cart = Input.cart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set($inputRoot = $input.path('$')) | |
{ | |
"X-Shopify-Shop-Domain": "$input.params().header.get('X-Shopify-Shop-Domain')", | |
"X-Shopify-Topic": "$input.params().header.get('X-Shopify-Topic')", | |
"X-Shopify-Hmac-SHA256": "$input.params().header.get('X-Shopify-Hmac-SHA256')", | |
"body": "$util.base64Encode($input.body)", | |
"queue": "$stageVariables.sqs_queue", | |
"client_secret": "$stageVariables.client_secret" | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var AWS = require('aws-sdk'); | |
var sqs = new AWS.SQS(); | |
var crypto = require('crypto'); | |
exports.handler = (event, context, callback) => { | |
var client_secret = event.client_secret; | |
delete event.client_secret; | |
//calculate the hash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Set variables for our request | |
$shop = "demo-shop"; | |
$token = "SWplI7gKAckAlF9QfAvv9yrI3grYsSkw"; | |
$query = array( | |
"Content-type" => "application/json" // Tell Shopify that we're expecting a response in JSON format | |
); | |
// Webhook content, including the URL to POST to |