Skip to content

Instantly share code, notes, and snippets.

View devdarren7's full-sized avatar

devdarren7

  • DevDarren
View GitHub Profile
@devdarren7
devdarren7 / shopify-theme-asset-create.js
Last active October 1, 2022 15:09
Node JS Shopify Theme Asset Create
const shopify = new Shopify({ shopName:shop, accessToken: resulFromDataBase.access_token ,apiVersion:'2021-10' });
shopify.theme.list({}).then(async (meta)=>{
meta.forEach(element => {
if (element.role ==='main'){
console.log(element.id);
themeid = element.id ;
// I need to tell Shopify which asset im looking for and the value
@devdarren7
devdarren7 / Dawn-fixed-collection-via-linklist
Created July 26, 2021 21:01
Dawn assign collection to linklist
@devdarren7
devdarren7 / collectionMenu
Created July 25, 2021 21:49
Dawn Linklist Issues
{% if linklists[settings.sidebar_linklist_1].links.size == 0 %}
<div class="section-header">
<p class="section-header__title h4">{{ 'layout.sidebar_onboarding.shop_by_collection' | t }}</p>
</div>
{{ 'layout.sidebar_onboarding.shop_by_collection_description_html' | t }}
{% endif %}
{% for i in (1..5) %}
{% capture setting_key %}sidebar_linklist_{{ i }}{% endcapture %}
?
//class KitWuBook
class KitWuBook {
//vars
// private $var = 'default';
const HOST = 'https://wubook.net:443/xrws/';
private $srv;
private $acc = ;
/**
* ./routes/api.js
* This is where you'll set up any REST api endpoints you plan on using.
*/
const express = require('express');
const router = express.Router();
router.get('/', (req, res, next) => {
var xmlrpc = require('xmlrpc')
{% assign tabStuff = tabStuff | split :"," %}
{% if product.tags contains 'tabs_1'%}
{% assign tabs = "Tasting Notes, Food Complements, Vinification" | split :"," %}
{% elsif product.tags contains "tabs_2" %}
{% assign tabs = "Tasting Notes, Food Complements, Vintage, Vinification, Awards" | split :"," %}
{% else product.tags contains "tabs_3" %}
@devdarren7
devdarren7 / ajax.js
Last active July 16, 2019 08:19
Deon add multiple ajax
$(document).ready(function(){
$( ".product" ).each(function(index) {
// hi ---> .product is the class name that represents the product element.
var title = $(this).find('a.title-5').html();
// I have above said we are now looking inside the current product div before looking in the next one
// this represents the current product div the loop is in / on. we then use jquery .find() to look for elements inside this div and then .html() grabs the content
// Add to cart code here.
$.post('/cart/add.js', {
quantity: 1,
const express = require('express');
const Shop = require('../models/Shop');
const Shopify = require('shopify-node-api');
const config = require('../config');
const generateNonce = require('../helpers').generateNonce;
const buildWebhook = require('../helpers').buildWebhook;
const bodyParser = require('body-parser');
const url = require('url');
const querystring = require('querystring');
const router = express.Router();
@devdarren7
devdarren7 / mongoose_save.js
Created April 23, 2019 15:00
Mongoose db insert one example
db.collection('admin').insert({accessToken: accessToken , email: 'admin@gmail.com' } , (err, result) => {
if (err) return console.log(err)
console.log('saved to database' + accessToken);
res.render('pages/main-dash');
//res.render('index', { accessToken: JSON.stringify(accessToken)} );
})
@devdarren7
devdarren7 / app.js
Created February 23, 2019 07:35
shopify authentication
var express = require('express');
var router = express.Router();
var app = express();
const nonce = require('nonce')();
const cookie = require('cookie');
const forwardingAddress = "https://bonitoco.herokuapp.com/";
var apiSecret = process.env.SHOPIFY_API_SECRET;
var apiKey = process.env.SHOPIFY_API_KEY ;
const scopes = 'read_products';