Skip to content

Instantly share code, notes, and snippets.

@matt-cos
matt-cos / ajax-cart-page.js
Last active December 22, 2020 21:03
A snippet that can be added to stock Impulse themes to give AJAX functionality to the /cart page. This is basically a public API, exposing cartPage methods and variables to work with in other JS files
/**
* simply add this file to theme.liquid in order to have the /cart page update
* using ajax. the only dependency is theme.jQuery
*/
window.cartPage = window.cartPage || {};
(function($){
var $ = jQuery = $;
@matt-cos
matt-cos / snippets.liquid
Last active April 25, 2023 02:13
Shopify Snippets
{% comment %}
HTML product form that can add multiple products/quantities in one submit
The values are each a variant ID
{% endcomment %}
<form action="/cart/add" method="post">
<input type="hidden" name="items[0][id]" value="32387308847153">
<input type="number" name="items[0][quantity]" value="1">
<input type="hidden" name="items[0][properties][_Gift wrap]" value="No">