Skip to content

Instantly share code, notes, and snippets.

@dturton
dturton / webpack.config.js
Created May 13, 2016 23:24 — forked from learncodeacademy/webpack.config.js
Sample Basic Webpack Config
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/scripts.js",
output: {
path: __dirname + "/js",
filename: "scripts.min.js"
@dturton
dturton / gist:7d71edca96b5fb3805eb5af2d8604a32
Created August 6, 2016 23:33 — forked from kyleaparker/gist:7812970
Shopify Lockdown App: How to remove the "Continue as Guest" button from the login screen.
<!--In theme.liquid, change:-->
<meta content="0; url=/account/login?checkout_url={{ return_url }}" http-equiv="refresh" />
<!--to -->
<meta content="0; url=/account/login?return_url={{ return_url }}" http-equiv="refresh" />
<!-- In customers/login.liquid, give the submit button an ID of customerlogin, for example: -->
@dturton
dturton / Much much simpler option selector for Shopify
Created April 29, 2017 15:04 — forked from zakhardage/Much much simpler option selector for Shopify
Much simpler version of Shopify's option_selection.js for separating product options into their own dropdown menus.
<form action="/cart/add" method="post">
{% if product.variants.size > 1 %}
{% if product.options[0] %}
{% assign used = '' %}
<label for="select-one">{{ product.options[0] }}</label>
<select id='select-one' onchange="letsDoThis()">
{% for variant in product.variants %}
{% unless used contains variant.option1 %}
<option value="{{ variant.option1 }}">{{ variant.option1 }}</option>
{% capture used %}{{ used }} {{ variant.option1 }}{% endcapture %}
{% comment %}
To add a companion product to the cart automatically if a primary product is in cart:
1. Create a new link list under your Navigation tab.
2. In that link list, make the first link point to companion product.
3. Copy your link list handle where indicated at line 9
4. Set the minimum cart total required for the bonus product on line 10
{% endcomment %}
{% assign linklist = linklists['put-your-link-list-handle-here'] %}
{% assign min_total = 100 %}
discounted_product = 12275195905
products_needed = [592406273]
products_seen = []
Input.cart.line_items.each do |line_item|
product = line_item.variant.product
products_seen << product.id if products_needed.include?(product.id)
end
Input.cart.line_items.each do |line_item|
@dturton
dturton / Free Gift.rb
Created January 18, 2018 18:07 — forked from HillbergAndBerkIT/Free Gift.rb
Shopify Scripts
# See https://onlygrowth.com/blogs/posts/17-shopify-scripts-to-maximize-conversions for some helpful snippets
class FreeGift
def initialize(variant_id, minTotal, message, quantity = 1)
@variant_id = variant_id
@minTotal = minTotal
@message = message
@giftQuantity = quantity
end
# Get the total of the cart without the variant price being included
@dturton
dturton / gift-modal.md
Created May 12, 2018 13:55 — forked from jgodson/gift-modal.md
Free Gift Modal for Shopify Themes

How to install

  1. Copy the following code and paste it at the end of config/settings_schema.json, just after the last }. Then save the file.
,
  {
    "name": "Free Gift Offer",
    "settings": [
      {
        "type": "header",
        "content": "Offer a free gift with discount code on cart page"
# Stop customers from using a discount code
# This script will reject all discount codes. Useful if you have a sale
# and don't want additional discounts to be applied
# Set the rejection message for discount codes
REJECTION_MESSAGE = "Discount codes cannot be used during this sale"
class RejectAllDiscountCodes
# Initializes the campaign.
#
@dturton
dturton / README.md
Created November 7, 2018 19:26 — forked from joyrexus/README.md
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
import Axios from 'axios'
state = {
todos : null
},
getters = {
TODOS : state => {
return state.todos;
}
},