Skip to content

Instantly share code, notes, and snippets.

View sillycube's full-sized avatar

sillycube sillycube

View GitHub Profile
@FLWallace105
FLWallace105 / Readme.md
Last active November 13, 2024 04:38
Shopify function 2 for 25 How To

Create a Shopify Function to do 2 for $25 Items

Requirements: You want a Shopify Function to do a 2 for $25 discount like what is availble in Shopify Scripts (soon to be removed).

Your products can have different prices, some might be $29.99, some might be $25.99, others might be $19.99. You don't want to change the original prices. You want every combination of eligible produccts to be discounted to $12.50, i.e. "2 for $25" and if you have an odd total: say a cart has 2 of one eligble product and 3 of other eligible products, the most expensive one is not fully discounted (don't discount one of them). You also want a call to action to the customer to add another item in the not fully discounted line item to get the full discount.

Your eligible products are identified with a tag "2FOR25" .

Run.graphql

Your run.graphql should look like this:

@james2doyle
james2doyle / shopify-vue-app.js
Last active September 18, 2023 10:49
Support Vue apps inside the Shopify section editor. Supports refreshing the Vue instance when changes happen in the section editor
import Vue from 'vue';
/**
* EventHub to listen or broadcast to all components
*
* @see https://shopify.dev/tutorials/develop-theme-sections-integration-with-theme-editor
*
* Usage: eventHub.$on('shopify:section:select:{my-section-name}', (event) => handleSelect());
*
*/
@wowkin2
wowkin2 / Readme.md
Last active September 26, 2024 09:28
Solution: "Exceeded 4 calls per second for api client" Python Shopify API - shopify_python_api

Solution for API call limit "shopify_python_api"

If you are using Python Shopify API and getting following error
"Exceeded 4 calls per second for api client. Reduce request rates to resume uninterrupted service."
but want your script to continue working with some timeout after that,
you can use following script from shopify_limits_patch.py.

For that just copy shopify_limits_patch.py to your project and import shopify_limits_patch.

Or if you want to call it implicitly import it, remove last line patch_shopify_with_limits()
and call it before all your shopify calls.

@gokulkrishh
gokulkrishh / media-query.css
Last active May 5, 2025 08:36
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */
@iansltx
iansltx / _safari-iframe-cookie-workaround.md
Last active February 10, 2025 12:12
Safari iframe cookie workaround
@carolineschnapp
carolineschnapp / gist:9122054
Last active October 25, 2024 16:31
Order form to use in a page or collection template.
{% comment %}
Source: https://gist.github.com/carolineschnapp/9122054
If you are not on a collection page, do define which collection to use in the order form.
Use the following assign statement, replace 'your-collection-handle-here' with your collection handle.
{% assign collection = collections.your-collection-handle-here %}
Use the assign statement outside of this comment block at the top of your template.
{% endcomment %}
{% paginate collection.products by 100 %}
@zakhardage
zakhardage / Much much simpler option selector for Shopify
Last active February 10, 2025 17:29
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 %}
@oodavid
oodavid / README.md
Created March 26, 2012 17:05
Backup MySQL to Amazon S3

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc