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
{% assign maxwords = 30 %} | |
{% if template == 'product' %} | |
{% if collection %} | |
<link rel="canonical" href="{{ shop.url }}{{ product.url }}" /> | |
{% endif %} | |
{% assign mf = product.metafields.meta_data %} | |
{% unless mf == empty %} | |
{% for mf in product.metafields.meta_data' %} | |
{% capture key %}{{ mf | first }}{% endcapture %} | |
{% if key == 'title' %} |
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
{% comment %} | |
- add this snippet to any product.liquid template, at the top of the file, and you can access the extra data provided by | |
the new version of Meta Tagger that supports Google Shopping. | |
{% endcomment %} | |
{% if template contains 'product' %} | |
{% if product.metafields.global %} | |
{% for mf in product.metafields.global %} |
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
<!-- | |
* a simple HTML DOM element for rendering related products. | |
* Style with CSS to make the <ul> look like whatever you want. | |
* place this snippet in your product.liquid where you would like the related products to appear | |
--> | |
<div id="related-products-container"> | |
<h1>YOU MIGHT LIKE THIS!</h1> | |
<div id="related"> | |
<ul class="related"> |
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
{% capture title %}<title>{{ shop.name }} | {{ page_title }}</title>{% endcapture %} | |
{% if template == 'product' %} | |
{% assign mf = product.metafields.meta_data %} | |
{% unless mf == empty %} | |
{% for mf in product.metafields.meta_data' %} | |
{% capture key %}{{ mf | first }}{% endcapture %} | |
{% if key == 'title' %} | |
{% capture title %}<title>{{mf | last}}</title>{% endcapture %} | |
<meta name="title" content="{{mf | last}}" /> | |
{% endif %} |
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
order = ShopifyAPI::Order.find(id) | |
order.note = "Go ride a bike and stop being a whiny twerp." | |
order.save |
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
# here comes 1, 2, 200, or even 603 id's | |
get '/orders/do_it_man/?' do | |
if ShopifyAPI.credit_left > 0 | |
Delayed::Job.enqueue(Hookah::Pipe.new(current_shop.site, params[:ids])) # <-- regular run, we have some credit... | |
else | |
Delayed::Job.enqueue(Hookah::Pipe.new(current_shop.site, params[:ids]), 0, 601.seconds.from_now) # <--- no credit, run later | |
end | |
end | |
module Hookah |
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
class UnfulfilledOrder < ActiveRecord::Base | |
belongs_to :shop | |
has_many :items, :dependent => :delete_all | |
end | |
class Item < ActiveRecord::Base | |
belongs_to :unfulfilled_orders | |
has_many :deliveries, :dependent => :delete_all | |
end |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'shopify_api' | |
require 'thor' | |
require 'abbrev' | |
require 'yaml' | |
module ShopifyAPI | |
class Cli < Thor | |
include Thor::Actions |
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
class ActiveResource::Connection | |
# HACK 1: Add an attr_reader for response | |
attr_reader :response | |
def request(method, path, *arguments) | |
result = ActiveSupport::Notifications.instrument("request.active_resource") do |payload| | |
payload[:method] = method | |
payload[:request_uri] = "#{site.scheme}://#{site.host}:#{site.port}#{path}" | |
payload[:result] = http.send(method, path, *arguments) | |
end |
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
class ActiveResource::Connection | |
# HACK 1: Add an attr_reader for response | |
attr_reader :response | |
def request(method, path, *arguments) | |
result = ActiveSupport::Notifications.instrument("request.active_resource") do |payload| | |
payload[:method] = method | |
payload[:request_uri] = "#{site.scheme}://#{site.host}:#{site.port}#{path}" | |
payload[:result] = http.send(method, path, *arguments) | |
end |