Skip to content

Instantly share code, notes, and snippets.

View blanklob's full-sized avatar
👨‍🚀
Building on Shopify!

Youness Idbakkasse blanklob

👨‍🚀
Building on Shopify!
View GitHub Profile
@blanklob
blanklob / modal.tsx
Created January 4, 2024 15:44
Issue with app bridge modal snippet with select
import { Button, Frame, Page, Select, Text } from '@shopify/polaris'
import polarisStyles from '@shopify/polaris/build/esm/styles.css'
import { useCallback, useMemo, useState } from 'react'
import { AppProvider } from '@shopify/shopify-app-remix/react'
import { json, LoaderFunctionArgs } from '@remix-run/node'
import { env } from '~/env.server'
import { useLoaderData } from '@remix-run/react'
export async function loader({ request }: LoaderFunctionArgs) {
return json({ apiKey: env.SHOPIFY_API_KEY || '' })
@blanklob
blanklob / Checkout.jsx
Created August 24, 2023 14:11
Example checkout UI extension with external API call
import React, { useEffect, useState } from "react";
import {
reactExtension,
Divider,
Image,
Banner,
Heading,
Button,
InlineLayout,
BlockStack,
@blanklob
blanklob / gtm-shopify-custom-pixel.js
Created July 1, 2023 23:42
Google Tag Manager Shopify Custom Pixel
// Step 1. Add and initialize your third-party JavaScript pixel (make sure to exclude HTML)
// Make sure you update you GTM- Tag id
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXX');
window.dataLayer = window.dataLayer || [];
@blanklob
blanklob / ga4-shopify-custom-pixel.js
Created July 1, 2023 23:40
Google Analytics 4 Shopify Custom Pixel
// Step 1. Add and initialize your third-party JavaScript pixel (make sure to exclude HTML)
// Replace with you GA4 Tag
const TAG_ID = 'G-XXXXXXXXXX';
const script = document.createElement('script');
script.setAttribute('src', `https://www.googletagmanager.com/gtag/js?id=${TAG_ID}`);
script.setAttribute('async', '');
document.head.appendChild(script);
window.dataLayer = window.dataLayer || [];
@blanklob
blanklob / blank-cli-utils.sh
Last active July 15, 2022 12:16
Blank Command Line Utils
# Click the copy button in the right-hand corner.
blank()
{
__V="2.20.0"
__H="
Blanklob utils to work seamlessly with Shopify CLI $__V
USAGE
blank <command> [options]