Skip to content

Instantly share code, notes, and snippets.

View panoply's full-sized avatar
🥛
Rich in the hood

ΝΙΚΟΛΑΣ panoply

🥛
Rich in the hood
View GitHub Profile

EXPORT FROM DISCORD

Original score with help from the talented Dave Warrington.


I may have very well solved the version control paradigm for themes. It’s not possible in CI but publishing from local machines to your store/s is now roughly a 15s task. Quick little breakdown here:

As I’ve touched on before, I went down the versioning rabbit hole in an attempt to bring some sanity to this nexus. What I’ve come out on I think is pretty lean and does not get in the way. I’ve gone over a dozen ways to approach this but it feels as if this is now the final solution. Appropriating via CI shouldn’t be too difficult to apply. There are a couple commands which have relation to theme versioning and releases or better put “operations” for theme releases and publishing.

{% liquid
# ASSIGN CURRENCY CODE IF NOT PASSED
unless currency_code
assign currency_code = ' ' | append: cart.currency.iso_code
endunless
# ASSIGN CURRENCY SYMBOL IF NOT PASSED
unless currency_symbol
if cart.currency.iso_code != shop.currency.iso_code and currency_symbol contains '.'
@panoply
panoply / readme.md
Last active November 27, 2023 22:09
Shopify Markets Domain Parse

What is this?

Shopify offers a rather fustrating solution for localization on the front-end and developers are likely at the behest of their slop served up as the "Geo" app... We are not animals. Anyway, this is a tiny little url parser to extract subfolder prefixes and provides determination for cases where you are employing your own solution and have a webshop operating multiple domains and/or targeting different markets using subfolders.

The typings will explain in rich detail each value in the closure. If you don't use TypeScript then maybe try acting like an adult.

Usage

Usage is simple, and only configuration required is setting you main domain, by default the function assumed your main domain is using a .com extension, change this if it differs.

.m-0 {
margin: 0 !important;
}
.m-1 {
margin: 0.25rem !important;
}
.m-2 {
margin: 0.5rem !important;
export interface BrowserContextSuggestions {
detected_values: {
/**
* An object informing of the the visitors country and 2 letter country code
*/
country: {
/**
* The 2 letter country code
*/
@panoply
panoply / zip.ts
Created April 26, 2023 13:47
Country Code to Accurate ZIP code (postcode) maps.
export default {
AD: 'AD501',
AE: '32222',
AF: '1001',
AG: '00000',
AI: '2640',
AL: '1001',
AM: '0001',
AO: '1001',
AR: '1010',
type Primitive = | null | undefined | string | number | boolean | symbol | bigint;
type LiteralUnion<LiteralType, BaseType extends Primitive,> = LiteralType | (BaseType & Record<never, never>);
export interface Shopify {
PaymentButton: {
init(): any
}
autoloadFeatures(param: any): any
/**
* Only show in Theme previews, it's a class instance, yuck.
{% if type == 'heading' %}
<div class="col-12 mt-{{ block.mt }} mb-{{ block.mb }} tc">
<h1 class="mb-4">
{{ block.title }}
</h1>
<h4 class="my-3 fc-dark-gray italic uncase">
{{ block.subtitle }}
</h4>
<div class="{{ block.fs }} {{ block.ta }}">
import { LiteralUnion, AnyCase } from '@brixtol/tsutils';
import { CountryCodes } from '@brixtol/country-names';
export interface ICurrencies {
/** Andorra (Euro) */
AD: 'EUR',
/** United Arab Emirates (UAE Dirham) */
AE: 'AED',
/** Afghanistan (Afghani) */
AF: 'AFN',
export interface IEndpoints {
/**
* Returns Ajax Cart
*/
get: '/cart.json',
/**
* Add a product to cart
*/
add: '/cart/add.js',
/**