Skip to content

Instantly share code, notes, and snippets.

@gje4
gje4 / handler.js
Created September 25, 2023 19:55
Bloomreach
'use strict';
const BigCommerce = require("node-bigcommerce");
const request = require("request-promise");
const { BLOOMREACH_ACCOUNT_ID, BLOOMREACH_AUTH_KEY, BLOOMREACH_DOMAIN_KEY } = process.env;
async function getProductData(productId) {
const options = {
method: "GET",
uri: `https://api.bigcommerce.com/stores/${process.env.STORE_HASH}/v3/catalog/products/${productId}?include=primary_image`,
<script>
// Fetch Order Data
fetch('/api/storefront/order/{{checkout.order.id}}', {
credentials: 'include'
}).then(function (response) {
return response.json();
}).then(function (orderData) {
const orderDate = Date.now();
const requestOptions = {
method: 'POST',
// @ts-ignore
const dotenv = require('dotenv')
const algoliasearch = require('algoliasearch/lite')
const BigCommerce = require('node-bigcommerce')
dotenv.config()
const bigCommerceV3 = new BigCommerce({
logLevel: 'info',
clientId: process.env.BIGCOMMERCE_STORE_API_CLIENT_ID,
` const parent = document.links;
let data = sessionStorage.getItem('state');
const params = new URL(window.location.href).searchParams;
if(params.get('available_state')) {
for (const link of parent) {
console.log(link);
link.href+="?_bc_fsnf=1&available_state="+data
}
}
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 2.
"Product ID","Product Type",Code,Name,Brand,Description,"Cost Price","Retail Price","Sale Price","Calculated Price","Fixed Shipping Price","Free Shipping",Warranty,Weight,Width,Height,Depth,"Allow Purchases","Product Visible","Product Availability","Product Inventoried","Stock Level","Low Stock Level","Date Added","Date Modified","Category Details",Images,"Page Title","META Keywords","META Description","Product Condition","Product URL","Redirect Old URL?","Product Tax Code","Product Custom Fields"
234,P,BCZIPHOODIE,"Bigcommerce Zip-Up Hoodie","BC SWAG","Stay warm with this Bigcommerce zip-up hoodie. Winter is coming, but we've got selling to do! ",50.00,0.00,0.00,100.00,0.0000,N,,0.0000,10.0000,12.0000,4.0000,Y,Y,,N,0,0,02/05/2018,17/03/2021,"Category Name: Member, Category Path: Member|Category Name: Women, Category Path: Women|Category Name: Shirts, Category Path: Shirts|Category Name: Men, Category Path: Men|Category Name: pants, Category Path: pants|Category Name: Loungewear, Category Path: Accessories/Lo
{[{"sku": "401866", "option_values": [{"label": "Dazzle Melange", "option_display_name": "Color"}, {"label": "36 C", "option_display_name": "Size"}], "price": "30.00", "weight": "120", "image_url": "http://step-assetpush.s3.amazonaws.com/5028474_DAZ01.jpg"}, {"sku": "401869", "option_values": [{"label": "Dazzle Melange", "option_display_name": "Color"}, {"label": "34 D", "option_display_name": "Size"}], "price": "30.00", "weight": "120", "image_url": "http://step-assetpush.s3.amazonaws.com/5028474_DAZ01.jpg"}, {"sku": "401870", "option_values": [{"label": "Dazzle Melange", "option_display_name": "Color"}, {"label": "36 D", "option_display_name": "Size"}], "price": "30.00", "weight": "120", "image_url": "http://step-assetpush.s3.amazonaws.com/5028474_DAZ01.jpg"}, {"sku": "419674", "option_values": [{"label": "Stardust Melange/Cosmic", "option_display_name": "Color"}, {"label": "34 C", "option_display_name": "Size"}], "price": "35.00", "weight": "120", "image_url": "http://step-assetpush.s3.amazonaws.com/502847
import { FC, useEffect, useState, useCallback } from 'react'
import { Logo, Button, Input } from '@components/ui'
import useLogin from '@framework/use-login'
import { useUI } from '@components/ui/context'
import { validate } from 'email-validator'
interface Props {}
const LoginView: FC<Props> = () => {
// Form State
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
<script>
var obs = new MutationObserver(function(mutations, observer) {
$.each(mutations, function(i, mutation) {
var addedNodes = $(mutation.addedNodes);
var selector = "form, .checkout-step-info";
var filteredEls = addedNodes.find(selector).addBack(selector);
filteredEls.each(function() {
//get customer and adjust payment methods
# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
trigger:
- master
pool:
vmImage: ‘Ubuntu-16.04’
steps:
- task: NodeTool@0
add_filter( 'bigcommerce/channels/enable-multi-channel', '__return_true' );
if (function_exists('geoip_detect2_get_info_from_current_ip')) {
$userInfo = geoip_detect2_get_info_from_current_ip();
do_action( 'php_console_log', $userInfo->country->isoCode );
if ($userInfo->country->isoCode == 'ES') {
add_filter( 'bigcommerce/channel/current', function( $channel ) {
// logic to set the channel
return get_term( 33, \BigCommerce\Taxonomies\Channel\Channel::NAME );
}, 10, 1 );