This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: (function () { | |
if (window.location.href.indexOf("/admin/checkout/#/orders/") > 1) { | |
const orderId = window.location.hash.split('?')[0].split('/').pop(); | |
console.log("================== get data..."); | |
fetch(`/api/oms/pvt/orders/${orderId}`).then(order => order.json()).then(order => { | |
console.log("omsOrder", order); | |
getPostalCode = order.shippingData.address.postalCode; | |
getCountry = order.shippingData.address.country; | |
items = Object.values(order.items).map(value => { | |
let obj = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const orderJSON = require('./order.json'); | |
let simulation = {} | |
let arrayOfItems = [] | |
const items = Object.values(orderJSON.content.items).map(value => { | |
let obj = { | |
"id": value.id, | |
"quantity": value.quantity, | |
"seller": "1" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const url = "https://raiadrogasil.myvtex.com/checkout/cart/add/?sku=70288&qty=1&seller=1&sc=1?sku=12345&qty=1&seller=1&sc=1?sku=10253&qty=1&seller=1&sc=1" | |
let items = [] | |
const parameters = url.match(/\A?sku=[^&]+&\A?qty=[^&]+&*\A?seller=[^&]+&*/g) | |
console.log(parameters) | |
simulation = parameters.map(value => { | |
let obj = { | |
"id": value.match(/([\d]+)/g)[0], | |
"quantity": value.match(/([\d]+)/g)[1], | |
"seller": "1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const orderJSON = require('./order.json'); | |
let arrayOfItems = [] | |
let arrayOfItemsAsString = [] | |
let url = "" | |
const sc = orderJSON.content.salesChannel | |
const account = orderJSON.content.items[0].catalogProvider.split(":") | |
const items = Object.values(orderJSON.content.items).map(value => value.id) | |
arrayOfItems = items.map(value => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: (function () { | |
if (window.location.href.indexOf("/admin/checkout/#/orders/") > 1) { | |
const orderId = window.location.hash.split('?')[0].split('/').pop(); | |
console.log("================== get data..."); | |
fetch(`/api/oms/pvt/orders/${orderId}`).then(order => order.json()).then(order => { | |
console.log("omsOrder", order); | |
account = order.hostname; | |
console.log(account); | |
sc = order.salesChannel; | |
items = Object.values(order.items).map(value => { |