diff --git a/_packs/controllers/cart_confirmation_controller.js b/_packs/controllers/cart_confirmation_controller.js index 1b138ca..08e5287 100644 --- a/_packs/controllers/cart_confirmation_controller.js +++ b/_packs/controllers/cart_confirmation_controller.js @@ -11,16 +11,18 @@ export default class extends CartBaseController { if (!this.template) return - const order = this.cart.data.attributes - const products = this.products - const site = await this.site() - const shipping_address = JSON.parse(this.storage.getItem('shipping_address')) + if (this.storage.cart) { - const data = { - order, - products, - site, - shipping_address + const order = this.cart.data.attributes + const products = this.products + const site = await this.site() + const shipping_address = JSON.parse(this.storage.getItem('shipping_address')) + + const data = { order, products, site, shipping_address } + + this.storage.setItem('confirmation', JSON.stringify(data)) + } else { + data = JSON.parse(this.storage.getItem('confirmation')) } this.render(data)