Skip to content

Instantly share code, notes, and snippets.

View sommcoder's full-sized avatar
🏠
Working from home

Brian Davies sommcoder

🏠
Working from home
View GitHub Profile
@sommcoder
sommcoder / rokt-bottom-banner.liquid
Last active October 6, 2025 19:33
This is the original that was tested on Friday and what Armon has seen
<script>
(function () {
const promos = [
{%- for promo in metaobjects.rokt_banner_promos.values %}
{
url: '{{ promo.url | escape }}',
discount: '{{ promo.discount | escape }}',
referrer: '{{ promo.referrer | escape }}',
product: '{{ promo.product | escape }}',
}{%- if forloop.last == false %},{% endif -%}
@sommcoder
sommcoder / gist:d2bacc3738724c288dcf9e7860ae1da8
Last active October 1, 2025 15:48
Update Subtotal Price for Upcart Footer
<script>
// Add this to Upcart's beforeLoad. This should then just be assigned ONCE.
window.upcartEl = window.upcartDocumentOrShadowRoot;
function injectOriginalPrice(cart) {
// 1) Compute compare-at total
let compareTotal = 0;
for (const item of cart.items) {
const base = item.compare_at_price ?? item.final_price;
compareTotal += base * item.quantity;