Skip to content

Instantly share code, notes, and snippets.

View marioloncarek's full-sized avatar

Mario Loncarek marioloncarek

View GitHub Profile
import {formatMoney} from '@shopify/theme-currency/currency';
import {Power3, TweenMax} from 'gsap/TweenMax';
import $ from 'jquery';
const defaults = {
cartModal: '.js-ajax-cart-modal', // classname
cartModalClose: '.js-ajax-cart-modal-close', // classname
cartDrawer: '.js-ajax-cart-drawer', // classname
cartDrawerContent: '.js-ajax-cart-drawer-content', // classname
cartDrawerClose: '.js-ajax-cart-drawer-close', // classname
/**
* Product Template Script
* ------------------------------------------------------------------------------
* A file that contains scripts highly couple code to the Product template.
*
* @namespace product
*/
import $ from 'jquery';
import Variants from '@shopify/theme-variants';
/**
* Product Template Script
* ------------------------------------------------------------------------------
* A file that contains scripts highly couple code to the Product template.
*
* @namespace product
*/
import $ from 'jquery';
import Variants from '@shopify/theme-variants';
@marioloncarek
marioloncarek / ajax-cart.js
Created October 14, 2018 15:34
complete add bundle to cart shopify
import {formatMoney} from '@shopify/theme-currency/currency';
import {Power3, TweenMax} from 'gsap/TweenMax';
import $ from 'jquery';
const defaults = {
cartModal: '.js-ajax-cart-modal', // classname
cartModalClose: '.js-ajax-cart-modal-close', // classname
cartDrawer: '.js-ajax-cart-drawer', // classname
cartDrawerContent: '.js-ajax-cart-drawer-content', // classname
cartDrawerClose: '.js-ajax-cart-drawer-close', // classname
<div data-section-id="{{ section.id }}" data-section-type="product" data-enable-history-state="true"
class="{% if forloop.first == true %}p-single-product--bundle-single-active{% endif %} {% unless forloop.first == true %}p-single-product--bundle-single-disabled{% endunless %} {% if forloop.last == true %}p-single-product--bundle-single-last-step{% endif %} js-scroll-to-{{ forloop.index }}">
<section class="p-single-product p-single-product--bundle">
<!--single product slideshow and config-->
<div class="p-single-product__wrapper">
<div class="c-product-showcase c-product-showcase--bundle js-product-showcase">
@marioloncarek
marioloncarek / mobile-menu-karlo.js
Created October 18, 2018 11:20
mobile meni karlo
import {Power3, TweenMax} from 'gsap/TweenMax';
import $ from 'jquery';
export class MobileNav {
constructor(options) {
const _defaults = {
mobileMenuTrigger: '.js-mobile-menu-trigger',
mobileMenuClose: '.js-mobile-menu-close',
<script>
console.log('{{ image.variants[0].option1 | json }}')
</script>
@marioloncarek
marioloncarek / shopify-whitespace.liquid
Created November 21, 2018 08:28
how to write conditional classes in liquid because of whitespace
<main class="giftcard {% if gift_card.expired or gift_card.enabled != true %} giftcard--disabled{% endif %}">
{%- if gift_card.expired != true and gift_card.expires_on and gift_card.enabled -%}
<span class="giftcard-tag giftcard-tag--active">{{ 'gift_cards.issued.active' | t: expiry: gift_card_expiry_date }}</span>
{%- endif -%}
@marioloncarek
marioloncarek / shopify-blog-blocks.liquid
Created December 14, 2018 17:06
shopify blog blocks - not good
<div class="o-container">
<div class="o-row o-row--wide">
<div class="p-blog">
{% for block in section.blocks %}
<div class="p-blog__blocks single-category-block category-{{ block.settings.blog_category }}">
class JSONReader {
constructor(completed = null) {
this.onCompleted = completed;
this.result = undefined;
this.input = document.createElement('input');
this.input.type = 'file';
this.input.accept = 'text/json|application/json';
this.input.addEventListener('change', this.onChange.bind(this), false);
this.input.style.display = 'none';
document.body.appendChild(this.input);