diff --git a/src/lib/components/HeaderCommerce.svelte b/src/lib/components/HeaderCommerce.svelte index 7dd1826..528d321 100644 --- a/src/lib/components/HeaderCommerce.svelte +++ b/src/lib/components/HeaderCommerce.svelte @@ -1,6 +1,6 @@
@@ -34,22 +95,62 @@

Order Summary

- {#each $cart as item} + {#each $cartItems as item}
-

{item.product.title}

+

{item.title}

- {item.variant.title} × {item.quantity} + {#if item.variant && item.variant.title} + {item.variant.title} + {/if} + × {item.quantity}

-

{(item.variant.calculated_price.calculated_amount * item.quantity).toFixed(2)} €

+

{calculateItemTotal(item)} {currencySymbol}

{/each}
+ + +
+

Shipping Method

+ {#if isLoadingShipping} +
+ +
+ {:else if shippingOptions.length === 0} +
+ No shipping options available +
+ {:else} +
+ {#each shippingOptions as option} + + {/each} +
+ {/if} +
-
+
Total: - {calculateTotal($cart)} € + {calculateTotal($cartItems)} {currencySymbol}
diff --git a/src/lib/components/mini-cart.svelte b/src/lib/components/mini-cart.svelte index eff8837..dc95f5f 100644 --- a/src/lib/components/mini-cart.svelte +++ b/src/lib/components/mini-cart.svelte @@ -1,28 +1,42 @@ -{#if isOpen} +{#if $cartIsOpen}
cart.toggleCart()} + on:click={() => cart.toggle()} transition:fly={{ duration: 200, opacity: 0 }} >
@@ -35,7 +49,7 @@

Your Cart

- {#if $cart.length === 0} + {#if $cartItems.length === 0}
@@ -53,31 +67,35 @@

Add some items to get started

{:else}
- {#each $cart as item, i} + {#each $cartItems as item}
- {#if item.product.thumbnail} + {#if item.thumbnail} {item.product.title} {/if}
-

{item.product.title}

-

{item.variant.title}

+

{item.title}

+

+ {#if item.variant && item.variant.title} + {item.variant.title} + {/if} +

= 1) { - cart.updateQuantity(i, value); + cart.update(item.id, value); } }} />
-

{calculateItemTotal(item)} €

+

{calculateItemTotal(item)} {currencySymbol}

@@ -117,11 +135,11 @@ {/if}
- {#if $cart.length > 0} + {#if $cartItems.length > 0}
Total: - {calculateTotal($cart)} € + {calculateTotal($cartItems)} {currencySymbol}
@@ -130,7 +148,7 @@ diff --git a/src/lib/components/products.svelte b/src/lib/components/products.svelte index 6d9cb33..c3a4bf3 100644 --- a/src/lib/components/products.svelte +++ b/src/lib/components/products.svelte @@ -1,6 +1,7 @@
@@ -38,14 +55,14 @@ }} > {#each product.variants as variant} - + {/each} - {/each} +
+ +
+
+ {product.title}
-
- -
-
-

{product.title}

-

{selectedVariant.calculated_price.calculated_amount} {selectedVariant.calculated_price.currency_code}

-
- - {#each product.options as option} -
- - -
- {/each} - -

{product.description}

- -
- -
- - {#if selectedVariant.sku || product.weight || product.material} -
-

Product Details

-
    - {#if selectedVariant.sku}
  • SKU: {selectedVariant.sku}
  • {/if} - {#if product.weight}
  • Weight: {product.weight}g
  • {/if} - {#if product.material}
  • Material: {product.material}
  • {/if} -
+ {#if product.images.length > 1} +
+ {#each product.images as image, i} + + {/each}
{/if}
+ + +
+

{product.title}

+

{selectedVariant.calculated_price.calculated_amount} {currencySymbol}

+ +
+

{product.description}

+
+ + + {#if product.options.length > 0} +
+ {#each product.options as option} +
+ + +
+ {/each} +
+ {/if} + + +
+ +
+