Skip to content

Instantly share code, notes, and snippets.

@KamGraphica
KamGraphica / wp-config.php
Created March 3, 2021 16:19
Custom wp-config for wordpress behind reverse proxy & using a staging server
/* Staging and reverse proxy settings */
$public_url = 'https://public-server.com';
$production_server = 'production.example.com';
$staging_server = 'stage.example.com';
/* Staging and reverse proxy code */
if($_SERVER['REQUEST_URI'] == "/?cookiesetter"){
@KamGraphica
KamGraphica / gist:4523a6f351b1c3ac1a5ff8c6f8168970
Created February 22, 2017 06:25 — forked from kloon/gist:4541017
WooCommerce Clear Cart via URL
// check for clear-cart get param to clear the cart, append ?clear-cart to any site url to trigger this
add_action( 'init', 'woocommerce_clear_cart_url' );
function woocommerce_clear_cart_url() {
if ( isset( $_GET['clear-cart'] ) ) {
global $woocommerce;
$woocommerce->cart->empty_cart();
}
}
@KamGraphica
KamGraphica / gist:cb7f2f58be9d3df502b19fa9e59fdddd
Last active October 15, 2021 20:05
Shopify Plus - Shopify Script - Buy 4 get 1 Free - Products tagged "BOGO"
class TagSelector
def initialize(tag)
@tag = tag
end
# Returns whether a line item matches this selector or not.
#
# Arguments
# ---------
<h3>Join our Mailing List</h3>
<script type="text/javascript" src="//www1.moon-ray.com/v2.4/include/formEditor/genbootstrap.php?method=script&amp;uid=p2c12727f10&amp;version=1"></script>
<span class="moon-ray-form-placeholder-3456">
<link rel="stylesheet" href="//www1.moon-ray.com/formeditor/formeditor/css/form.default.css" type="text/css"><link rel="stylesheet" href="//www1.moon-ray.com/formeditor/formeditor/css/form.publish.css" type="text/css">
<link rel="stylesheet" href="//forms.moon-ray.com/v2.4/include/minify/?g=moonrayCSS" type="text/css"><link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/smoothness/jquery-ui.min.css" type="text/css">
<link rel="stylesheet" href="//www1.moon-ray.com/v2.4/include/formEditor/gencss.php?uid=p2c12727f10" type="text/css">
<div class="moonray-form-p2c12727f10">
<div class="moonray-form moonray-form-label-pos-stacked">
<form class="moonray-form-clearfix" action="https://forms.moon-ray.com/v2.4/form_processo
@KamGraphica
KamGraphica / shopify-add-to-cart
Created May 11, 2016 21:48 — forked from lucased/shopify-add-to-cart
Shopify - Add product to cart automatically
if (typeof Shopify === 'undefined') var Shopify = {};
Shopify.cart = {{ cart | json }};
Shopify.toAdd = 378589397;
var surchargeInCart = false;
var total = 2507; // total in cents.
for (var i=0; i<Shopify.cart.items.length; i++) {
if (Shopify.cart.items[i].id === Shopify.toAdd) {
surchargeInCart = true;
total -= Shopify.cart.items[i].line_price;
@KamGraphica
KamGraphica / gist:55a71a17a2177ca38904
Created March 4, 2015 04:11
Shopify - Show Price, Compare Retail Price, Dollar Amount Savings and Percentage Saved.
Product Price: {{ product.price | money }}
Compare Retail Price: {{ product.compare_at_price_max | money }}
You save: {{ product.compare_at_price_max | minus:product.price | difference:product.compare_at_price_max | money }}
You save: {{ product.compare_at_price_max | minus:product.price | times:100 | divided_by:product.compare_at_price_max }}%