Skip to content

cart not being update after adding item #85

Description

@Matanelc

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)
})
})

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions