Skip to content

Instantly share code, notes, and snippets.

View pveen2's full-sized avatar
☀️

Paul pveen2

☀️
  • Ask Phill
View GitHub Profile
const wishlistApi = async ({req, res, shopifyAccessToken, shopifyDomain, allowedOrigins, metafieldNamespace, metafieldKey}) => {
const shopifyAdminConfig = {
Accept: 'application/json',
'Content-Type': 'application/json',
'X-Shopify-Access-Token': shopifyAccessToken,
};
const apiVersion = '2022-07'
const preparePayload = (query, variables) => ({
query,
@pveen2
pveen2 / component.image.liquid
Created September 16, 2022 06:14
Shopify image component
{%- comment -%}
Expected behaviour:
Renders picture element
About:
Render a responsive image
Accepts:
- img: {Object} image
@pveen2
pveen2 / gist:3e7bdb62e71102abd316bb2fcbe28251
Last active June 21, 2021 12:13
shopify-direct-chekcout-hook
import { decode } from 'shopify-gid';
const shopifyUrl = 'https://askphill.com'
export function useDirectCheckoutItems() {
// items is [{quantity: quantity, variantId: 'variantId'}]
async function checkoutItems(items) {
if (items.length < 1) {
throw new Error('Must include at least one line item, empty line items found');
}