Skip to content

Instantly share code, notes, and snippets.

View ihorduchenko's full-sized avatar
💭
Working

Ihor Duchenko ihorduchenko

💭
Working
View GitHub Profile
@ihorduchenko
ihorduchenko / Shopify Script Discounting
Created January 21, 2024 16:09 — forked from jimmijazz/Shopify Script Discounting
Shopify Script Discounting example
# ================================ Customizable Settings ================================
# ================================================================
# Tiered Discounts by Quantity
#
# A list of discount tier offers where:
# - 'product_selector_match_type' determines whether we look for
# products that do or don't match the entered selectors. Can
# be:
# - ':include' to check if the product does match
# - ':exclude' to make sure the product doesn't match
@ihorduchenko
ihorduchenko / bulk-volume-pricing.rb
Created January 20, 2024 19:14
Shopify Scripts: Bulk volume pricing
# ================================ Customizable Settings ================================
# ================================================================
# Tiered Product Discount by Quantity
#
# If the total quantity of matching items is greater than (or
# equal to) an entered threshold, the associated discount is
# applied to each matching item.
#
# - 'product_selector_match_type' determines whether we look for
# products that do or don't match the entered selectors. Can
@ihorduchenko
ihorduchenko / add-to-cart-link.liquid
Created January 5, 2024 13:23
Shopify: link for automatically adding product to cart
@ihorduchenko
ihorduchenko / auto-applied-discount-url-example.txt
Created December 18, 2023 23:45
Shopify: example of a shareable link to apply the discount code in cart with redirection to the target page
https://westernrise.com/discount/GIFT22?redirect=%2Fcollections%2Fbottoms
@ihorduchenko
ihorduchenko / recommended-font-settings.css
Created October 11, 2023 06:52
Recommended setting for correct fonts displaying
@ihorduchenko
ihorduchenko / square-circle-substracts.html
Created October 5, 2023 10:08
A square cut by a sector of a circle (outer and inner parts)
<!-- Outer part or a circle -->
<svg width="100" height="100" viewBox="0 0 215 215" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M214.5 214.5H0V0C0 118.465 96.0349 214.5 214.5 214.5Z" fill="black"/>
</svg>
<!-- Inner part of a circle (sector) -->
<svg height="100" width="100" viewBox="0 0 512 512" fill="#000" xmlns="http://www.w3.org/2000/svg">
<path d="M0,0v512h512C512,229.2,282.8,0,0,0z"/>
</svg>
@ihorduchenko
ihorduchenko / template-redirect-ablyft.js
Created August 18, 2023 19:49
Set URL parameter for template redirect on ABLyft
var url = new URL(window.location.href);
url.searchParams.set('view', 'upsell-bundle');
ablyftTools.redirect(url.toString());
@ihorduchenko
ihorduchenko / shopify-checkout.liquid
Created August 9, 2023 19:06
Manipulate with checkout discount area using Shopify Checkout library + js modules assets
{%- comment -%}
https://www.npmjs.com/package/@adearriba/shopify-checkout?activeTab=code
{%- endcomment -%}
<script type="module" src="{{ 'shopify-checkout.js' | asset_url }}"></script>
<script>
import { $checkout } from './shopify-checkout.js';
$checkout.on('load', (e) => {
console.log(e);
let discountNumberLineEl = document.querySelector('[data-checkout-discount-amount-target]');
@ihorduchenko
ihorduchenko / 2-fetch-calls.js
Created August 8, 2023 23:01
Handle 2 fetch API calls one by one
var post;
// Call the API
fetch('https://jsonplaceholder.typicode.com/posts/5').then(function (response) {
if (response.ok) {
return response.json();
} else {
return Promise.reject(response);
}
}).then(function (data) {
@ihorduchenko
ihorduchenko / close-dropdown-on-click-outside.html
Created August 4, 2023 20:00
Close dropdown on clicking outside
<fieldset class="filtersDropdown">
<div class="filtersDropdownTrigger">
Dropdown trigger
<div class="caret pointer-events-none">
<svg class="pointer-events-none"><use xlink:href="#icon-angle-down"></use></svg>
</div>
</div>
<div class="dropdown-body"></div>
</fieldset>