Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am expl0ratory on github.
  • I am amorse (https://keybase.io/amorse) on keybase.
  • I have a public key ASBifpnJ4yiXl4KtFhVCPSwUiiUyr_0lmjiM2t6DPILhdgo

To claim this, I am signing this object:

@expl0ratory
expl0ratory / Add an item to cart
Last active November 20, 2019 19:41
Cratejoy AJAXable Storefront Endpoints
$.ajax({
type: 'POST',
url: '/cart/add',
data: {
quantity: 1,
term_cycles: cycle_count, // ecom products have no term_cycles
// if it's a pre-pay sub, the # of prepaid cycles is this value, 1 = month-to-month
// 3 = quarterly prepay, etc
product_id: item.id // product_instance_id
},
@expl0ratory
expl0ratory / subscribe.html
Last active August 29, 2015 14:05
Add an editable text area to subscription term
{%- macro term_cell(np, loop, term_price) -%}
{% if term_price.term.enabled %}
{% set term = term_price.term %}
{{ cell_div(np, loop.first) }}
<div class="promo-border">
<h2 data-barley="term.{{ term.id }}.name" data-barley-editor="simple">
{{ term.name | safe }}
</h2>
<div class="product_image_container" data-barley="term.{{ term.id }}.img" data-barley-editor="image-logo">
{{ ("images/style2/shaving-box" ~ loop.index ~ ".png") | asset_url | img_tag(css_class="product_image") }}
input {
stdin {
codec => multiline {
pattern => "^%{DATESTAMP} "
negate => true
what => "previous"
}
}
}