Skip to content

Instantly share code, notes, and snippets.

View megasmack's full-sized avatar
☁️

Steve Schrab megasmack

☁️
View GitHub Profile
@megasmack
megasmack / fetchCommerceUrl.js
Created July 13, 2025 13:06 — forked from nocrates/fetchCommerceUrl.js
From B2BCommerce (Commerce on Core) for Salesforce, using the LWC (Lightning Web Component) within the LWR, this gist will call a commerce-api URL with the session credentials of the running user.
/* Returns a promise */
fetchCommerceUrl(url) {
let apiver = 'v64.0';
let commercebase = '/webruntime/api/services/data/' + apiver + '/commerce';
let fullurl = commercebase + url;
console.log('Begin fetchCommerceUrl on ', fullurl);
return fetch(fullurl, {
method: 'GET',