Skip to content

Instantly share code, notes, and snippets.

View atikju's full-sized avatar

MD. Atiqur Rahman atikju

View GitHub Profile
@atikju
atikju / on-sale.liquid
Created January 20, 2019 03:06
Shopify - Show On Sale Badge
{% if product.compare_at_price_max > product.price %}
<div class="sale-badge">On Sale</div>
{% endif %}
@atikju
atikju / sold-out-badge.liquid
Created January 20, 2019 03:04
Shopify - Show Sold Out Badge
{% assign sold_out = false %}
{% assign sold_out_text = 'products.product.sold_out' | t %}
{% unless product.available %}
{% assign sold_out = true %}
{% endunless %}
@atikju
atikju / section.liquid
Last active May 18, 2019 01:32
Shopify - Sample Section
<div class="devTopbar center">
<p>{{ section.settings.dev-top }} <span class="devClose">X</span></p>
{% for block in section.blocks %}
{{ block.settings.block-id }}
{% endfor %}
</div>
{% schema %}
@atikju
atikju / stockFinder.liquid
Created December 19, 2018 01:29
Shopify Swatch - find out of stock variants on click swatches
//find the select which has name="id" and replace with the following
<select id="product-select-{{ product.id }}{{ product-form }}{{ section.id }}{{ block.id }}" name="id" class="multi_select">
{% for v in product.variants %}
<option {% if v.inventory_quantity < 1 %}class="soldout"{% endif %} {% if v == variant %}selected="selected"{% endif %} value="{{ v.id }}" data-sku="{{ v.sku }}">{{ v.title }}</option>
{% endfor %}
</select>
//JS Part
<script>
$(document).ready(function(){
@atikju
atikju / full-width.css
Last active November 30, 2018 15:14
CSS - Force Full Width
/*
Here 300px is the parent width
*/
.autowide.devst {
width: 100vw;
background: #f1f2f2;
padding-top: 26px;
margin-left: calc(-100vw / 2 + 300px / 2);
margin-right: calc(-100vw / 2 + 300px / 2);
}
@atikju
atikju / popUpCart.liquid
Created November 22, 2018 20:22
Shopify - Pop up cart
<!--Vertical Button-->
<div class="devst-vertical-button-content">
<p class="devst-vertical-text devst-triangle-left">&#9651;</p><button class="devst-vertical-btn"><p class="devst-vertical-text devst-is_italic"> PROJECT TOTALS </p></button><p class="devst-vertical-text devst-triangle-right">&#9651;</p>
</div>
<div class="devst-pop-cart">
<div class="devst-cartBox">
<img src="{{ 'cart-logo.png' | asset_url }}" class="pop-logo">
<div class="dev-divider"></div>
<div class="itemHolder">
@atikju
atikju / collection.liquid
Last active November 21, 2018 21:26
Shopify - infinite scroll collection pages
<!--Templates/collection.liquid-->
{% paginate collection.products by 12 %}
<div class="devProductContainer">
{% for product in collection.products %}
{% include 'product-loop' %}
{% endfor %}
</div>
<!-- status elements -->
<div class="scroller-status">
<div class="infinite-scroll-request loader-ellips">
@atikju
atikju / InfiniteScroller.liquid
Created November 20, 2018 16:37
Shopify - Infinite Scrolling on Collection Pages
//This file needs to be hooked at the bottom of theme.liquid right before the </body>
{% if template.name contains 'collection' %}
{% assign product_per_page = 24 %}
<script>
$(document).ready(function() {
var counter = 2
var pages = Math.ceil('{{ collection.all_products_count }}' / {{ product_per_page }});
var maxCount = pages + 1;
console.log("Pages Found: " + pages);
@atikju
atikju / StockChanger.liquid
Created November 15, 2018 17:10
Show Stock Quantity in Product Page - Shopify
{% comment %} this code goes at the footer {% endcomment %}
{% if template.name == 'product' %}
{{ 'option_selection.js' | shopify_asset_url | script_tag }}
<style>
.selector-wrapper {
display: none !important;
}
</style>
<script>
@atikju
atikju / switchCase.liquid
Created November 7, 2018 14:07
Shopify Switch Case
{% assign handle = 'cake' %}
{% case handle %}
{% when 'cake' %}
This is a cake
{% when 'cookie' %}
This is a cookie
{% else %}
This is not a cake nor a cookie
{% endcase %}