Skip to content

Instantly share code, notes, and snippets.

vtexjs.checkout.getOrderForm().then(function (orderForm) {
var clientProfileData = orderForm.clientProfileData;
if(clientProfileData == null || clientProfileData == undefined){
var ClientProfileDataCallCenterDisclaimer = function() {this.attachmentId = "clientProfileData";this.email = null;};
clientProfileData = new ClientProfileDataCallCenterDisclaimer();
}
clientProfileData.email = 'exemplo@email.com'; // APLICA O EMAIL DESEJADO
return vtexjs.checkout.sendAttachment('clientProfileData', clientProfileData)
}).done(function (orderForm) {
@igorpoubel
igorpoubel / eraseCart_vtex.js
Created July 5, 2021 19:53
Script responsável por zerar todas as informações do checkout VTEX
const eraseCart = () => {
document.cookie = `checkout.vtex.com=;Domain=.${window.location.hostname};path=/;expires=Thu, 01-Jan-1970 00:00:01 GMT`;
$.ajax({
url: `${location.origin}/api/checkout/pub/orderForm/`,
type: "GET",
dataType: "json",
success: () => {
location.replace(`${location.origin}/checkout`);
},
error: (error) => {
@igorpoubel
igorpoubel / shippintOptionLS.js
Created April 6, 2020 14:20
Get (and change), via LocalStorage, the shipping option on VTEX
var data = JSON.parse(window.localStorage.getItem('aditionalShippingData'));
data.selectedLeanShippingOption = "FASTEST"; // ou CHEAPEST
window.localStorage.setItem('aditionalShippingData',JSON.stringify(data));