diff --git a/src/templates/_components/app/coupon-code.twig b/src/templates/_components/app/coupon-code.twig index 4cd8ce9..ca30e8c 100644 --- a/src/templates/_components/app/coupon-code.twig +++ b/src/templates/_components/app/coupon-code.twig @@ -1,4 +1,16 @@ -
+{% set couponCodeError = cart.getFirstNotice(null, 'couponCode') ?? null %} +{% set couponCodeSuccess = craft.app.session.getFlash('success') ?? null %} + +{% if couponCodeError %} + {% set couponMessage = couponCodeError.message %} +{% else %} + {% set couponMessage = (couponCodeSuccess and cart.couponCode) ? couponCodeSuccess : null %} +{% endif %} + +
+
+ +{% do cart.clearNotices(null, 'couponCode') %} +{% do craft.app.elements.saveElement(cart) %} diff --git a/src/templates/_components/app/line-item-cart.twig b/src/templates/_components/app/line-item-cart.twig index 74f8d7e..837ba26 100644 --- a/src/templates/_components/app/line-item-cart.twig +++ b/src/templates/_components/app/line-item-cart.twig @@ -25,26 +25,27 @@ class="flex justify-start items-stretch gap-5 p-5 bg-gray-200 rounded-xl" > -
-
+
+
{{ 'Image of'|t('foster-checkout') ~ ' ' ~ lineItem.description }}
-
+
-
+

{{ lineItem.description }}

-

{{ 'SKU'|t('foster-checkout') }}: {{ lineItem.sku }}

+

{{ 'SKU'|t('foster-checkout') }}: {{ lineItem.sku }}

{% if lineItem.purchasable.onPromotion %}

+

{% if label|default %}
diff --git a/src/templates/_components/base/input-text-clearable.twig b/src/templates/_components/base/input-text-clearable.twig index 93f1510..c58a1c3 100644 --- a/src/templates/_components/base/input-text-clearable.twig +++ b/src/templates/_components/base/input-text-clearable.twig @@ -7,7 +7,12 @@ {% endif %}
+ v-scope="ClearableInput({ + name: '{{ name|default('') }}', + value: '{{ value|default('') }}', + errors: {{ errors|default([])|json_encode }}, + success: {{ success|default([])|json_encode }} + })"> {% if label|default %}
diff --git a/src/translations/en/foster-checkout.php b/src/translations/en/foster-checkout.php index b2fcc4b..4f978c9 100644 --- a/src/translations/en/foster-checkout.php +++ b/src/translations/en/foster-checkout.php @@ -28,7 +28,7 @@ 'Coupon Code' => 'Coupon Code', 'Coupon added' => 'Coupon added', 'Submit a coupon code to get a discount on your order.' => 'Submit a coupon code to get a discount on your order.', - 'Enter your Coupon Code' => 'Enter your Coupon Code', + 'Enter Coupon Code' => 'Enter Coupon Code', 'Submit' => 'Submit', 'Estimated shipping to' => 'Estimated shipping to', 'Get estimated shipping' => 'Get estimated shipping', diff --git a/src/web/assets/checkout/dist/js/app.js b/src/web/assets/checkout/dist/js/app.js index 727f9d7..4525d2f 100644 --- a/src/web/assets/checkout/dist/js/app.js +++ b/src/web/assets/checkout/dist/js/app.js @@ -14,6 +14,7 @@ const ClearableInput = (props) => { name: props.name, value: props.value, errors: props.errors, + success: props.success, showButton: false, input() { this.showButton = this.value !== '';