Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cart not being update after adding item #85

Open
Matanelc opened this issue Apr 4, 2022 · 0 comments
Open

cart not being update after adding item #85

Matanelc opened this issue Apr 4, 2022 · 0 comments

Comments

@Matanelc
Copy link

Matanelc commented Apr 4, 2022

below I have POC snippet that adds the item to the cart (load all deps and then call add to cart).
item was added but it's not causing the cart to reload and you will see that item was added on the next refresh is there any way to trigger the refresh without reloading the page?
im trying to create thrid party app.
function loadJS(file) {
var jsElm = document.createElement("script");
jsElm.type = "application/javascript";
jsElm.src = file;
document.body.appendChild(jsElm);
}

loadJS("https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js")
loadJS("https://io.vtex.com.br/vtex.js/2.0.0/vtex.min.js")

var item = {
id: 355027,
quantity: 1,
seller: "1",
}
vtexjs.checkout
.getOrderForm()
.then(function(orderForm) {
console.log(orderForm)
vtexjs.checkout.addToCart([item], null, "1").done(function(orderForm) {
alert("Item added!")
console.log(orderForm)
})
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant