Skip to content

Instantly share code, notes, and snippets.

View YannisDC's full-sized avatar

Yannis De Cleene YannisDC

View GitHub Profile
@edlaver
edlaver / writeMetafieldFromGadgetRecord.js
Last active November 7, 2023 10:57
Add as an update effect to a Gadget record that has your metafield.
module.exports = async ({ api, record, params, logger, connections }) => {
const metafieldNamespace = "<Your metafield namespace>";
const metafieldKey = "<Your metafield key>";
const metafieldType = "json"
const metafieldOwnerId = `gid://shopify/Shop/${record.id}`; // `record.id` here is the ID of our `shop` record
const gadgetFieldName = "<The matching field name in your gadget record, e.g. myMetafield>";
// Check if record change includes our metafield data
if (record.changed(gadgetFieldName)) {
logger.info(
@AshikNesin
AshikNesin / react-file-upload.js
Created February 2, 2017 06:46
Simple React File Upload
import React from 'react'
import axios, { post } from 'axios';
class SimpleReactFileUpload extends React.Component {
constructor(props) {
super(props);
this.state ={
file:null
}