Skip to content

Instantly share code, notes, and snippets.

View atikju's full-sized avatar

MD. Atiqur Rahman atikju

View GitHub Profile
@atikju
atikju / refresh-woo-mini-cart.js
Created February 26, 2020 10:58
This little code snippet magically, refreshes the mini cart counter and contents
jQuery( document.body ).trigger( 'wc_fragment_refresh' );
{% comment %}
Reach author at [email protected] for any queries!
{% endcomment %}
<div class="devTopbar center">
<p>{{ section.settings.dev-top }}</p>
</div>
<style>
.devTopbar.center p {
color: #fff;
// 1. Enter sheet name where data is to be written below
var SHEET_NAME = "Sheet1";
// 2. Run > setup
//
// 3. Publish > Deploy as web app
// - enter Project Version name and click 'Save New Version'
// - set security level and enable service (most likely execute as 'me' and access 'anyone, even anonymously)
//
// 4. Copy the 'Current web app URL' and post this in your form/script action
@atikju
atikju / devsnest-styles.css
Last active January 28, 2020 07:22
Custom CSS grid library
/*General*/
.vertically-top{
vertical-align: top;
}
.vertically-center{
vertical-align: center;
}
.vertically-bottom{
vertical-align: bottom;
}
.btn{
box-shadow: inset 0 0 0 0 #31302B;
-webkit-transition: all ease 0.8s;
-moz-transition: all ease 0.8s;
transition: all ease 0.8s;
}
.btn{
box-shadow: inset 100px 0 0 0 #fff;
}
@atikju
atikju / MagicAddToCartButton.liquid
Created March 19, 2019 02:57
Shopify - Add To Cart Button with Link
<a href="https://site.com/cart/variant_id:qty" class="magic-add-cart-button">BUY NOW</a>
@atikju
atikju / multipleVariantAddCart.js
Last active February 11, 2019 02:29
Shopify - Add Multiple/Bundle Products to Cart
var available_ids = []; //array of 'varaint_id - qty'
//the following loop was for my case, you need to change the DOM selector for yours
$('.devTable tbody tr').each(function(){
var thisQty = $(this).find('.devQty input').val();
if(thisQty > 0){
var xVarID = $(this).find('.devQty input').attr('data-value');
var toPushItem = xVarID+'-'+thisQty;
available_ids.push(toPushItem);
}
}).promise().done( function(){
@atikju
atikju / product.liquid
Created February 1, 2019 02:09
Shopify - Show variant inventory on swatch click
<div id="variant-inventory" class="devst-variant-inventory">
{% if product.variants.first.inventory_management == "shopify" %}
{% if product.variants.first.inventory_quantity > 0 %}
{% if product.variants.first.inventory_quantity > 10 %}
{% assign hideValue = 'none' %}
{% else %}
{% assign hideValue = 'block' %}
{% endif %}
<span id="qtyLogic" style="display:{{ hideValue }}">
Only <span class="devStock">{{ product.variants.first.inventory_quantity }}</span> left!
@atikju
atikju / product.liquid
Created January 30, 2019 18:10
Shopify - Display products from specific collection in the product page
{% for product in collections[product.handle].products %}
{{ product.title }}
{% endfor %}
@atikju
atikju / accountCreatedPopUp.liquid
Last active January 26, 2019 01:25
Shopify - Create / Display Account Confirmation POP UP
{% comment %}
Add this snippet to your snippets folder and then include it at the very bottom of your theme.liquid right before </body>
The following script using fancybox app script. If your theme already has it in your theme, you can delete the fancy apps scripts.
{% endcomment %}
{% if template.name == 'index' %}
<!-- Fancy apps Scripts -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/[email protected]/dist/jquery.fancybox.min.css" />
<script src="https://cdn.jsdelivr.net/gh/fancyapps/[email protected]/dist/jquery.fancybox.min.js"></script>