Skip to content

Commit

Permalink
Modify order/cart summary (remove subtotal after discount)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjcallender committed Sep 30, 2024
1 parent bcb99fa commit f0568c8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 31 deletions.
8 changes: 4 additions & 4 deletions src/templates/_components/app/coupon-code.twig
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<button class="flex justify-between items-center w-full py-4" @click="isOpen = !isOpen">
<span id="couponCodeLabel" class="font-medium text-gray-500">
{{ 'Coupon Code'|t('foster-checkout') }}{% if cart.couponCode|default %} ({{ cart.couponCode }}){% endif %}
{{ 'Coupon code'|t('foster-checkout') }}{% if cart.couponCode|default %} ({{ cart.couponCode }}){% endif %}
</span>
<svg v-cloak xmlns="http://www.w3.org/2000/svg" width="14" height="9" viewBox="0 0 14 9" class="fill-current"
aria-hidden="true">
Expand Down Expand Up @@ -53,17 +53,17 @@
{{ hiddenInput('clearNotices', 'Yes, please!') }}
<p id="couponCodeDesc" class="sr-only">
{{ cart.couponCode|default ?
('Coupon Code'|t('foster-checkout') ~ ': ' ~ cart.couponCode) :
('Coupon code'|t('foster-checkout') ~ ': ' ~ cart.couponCode) :
'Submit a coupon code to get a discount on your order.'|t('foster-checkout') }}
</p>
{% include 'foster-checkout/_components/base/input-text-clearable' with {
label: 'Coupon Code'|t('foster-checkout'),
label: 'Coupon code'|t('foster-checkout'),
hideLabel: true,
id: 'couponCode',
name: 'couponCode',
type: 'text',
autocomplete: 'off',
placeholder: 'Enter Coupon Code'|t('foster-checkout'),
placeholder: 'Enter coupon code'|t('foster-checkout'),
errors: couponCodeError ? [couponMessage] : [],
success: cart.couponCode and couponMessage ? [couponMessage] : [],
value: cart.couponCode,
Expand Down
21 changes: 8 additions & 13 deletions src/templates/_components/app/summary-cart.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,15 @@
<dl class="grid grid-cols-1 gap-4">

<div class="flex justify-between items-center gap-4">
<dt class="text-gray-500">{{ 'Subtotal'|t('foster-checkout') }}</dt>
<dd class="font-semibold text-right text-black">{{ cart.itemSubtotalAsCurrency }}</dd>
<dt class="text-gray-500">{{ 'Items'|t('foster-checkout') }}</dt>
<dd class="text-right text-black">{{ cart.itemSubtotalAsCurrency }}</dd>
</div>

{% if cart.totalDiscount != 0 %}
<div class="flex justify-between items-center gap-4">
<dt class="text-gray-500">{{ 'Discount'|t('foster-checkout') }}</dt>
<dd class="text-right text-red-500">{{ cart.totalDiscountAsCurrency }}</dd>
</div>

<div class="flex justify-between items-center gap-4">
<dt class="font-semibold text-black">{{ 'Subtotal After Discount'|t('foster-checkout') }}</dt>
<dd class="font-semibold text-right text-black">{{ cart.totalAsCurrency }}</dd>
</div>
{% endif %}

{% if not cart.shippingAddressId %}
Expand All @@ -29,34 +24,34 @@
{% if craft.fostercheckout.getOption('enableFreeShippingMessage') %}
<p class="max-w-[210px] -mt-[8px] text-sm text-gray-500">
{{ 'Add'|t('foster-checkout') }}
<strong class="font-semibold text-black">$24.15</strong>
<strong class="text-black">$24.15</strong>
{{ 'for FREE shipping, or choose FREE Ship to Store.'|t('foster-checkout') }}
</p>
{% endif %}

{% else %}
<div class="flex justify-between items-center gap-4">
<dt class="text-gray-500">{{ 'Shipping'|t('foster-checkout') }}</dt>
<dd class="font-semibold text-right text-black">{{ cart.totalShippingCostAsCurrency }}</dd>
<dt class="text-gray-500">{{ 'Shipping & handling'|t('foster-checkout') }}</dt>
<dd class="text-right text-black">{{ cart.totalShippingCostAsCurrency }}</dd>
</div>
{% endif %}


<div class="flex justify-between items-center gap-4">
<dt class="text-gray-500">{{ 'Estimated Tax'|t('foster-checkout') }}</dt>
<dt class="text-gray-500">{{ 'Estimated tax'|t('foster-checkout') }}</dt>
<dd class="text-right text-black">{{ cart.totalTaxAsCurrency }}</dd>
</div>

{% include 'foster-checkout/_components/app/coupon-code' %}

{% if step|default('') != 'payment' %}
<div class="flex justify-between items-center gap-4">
<dt class="font-semibold text-black">{{ 'Estimated Total'|t('foster-checkout') }}:</dt>
<dt class="font-semibold text-black">{{ 'Estimated total'|t('foster-checkout') }}</dt>
<dd class="font-semibold text-right text-black">{{ cart.totalPriceAsCurrency }}</dd>
</div>
{% else %}
<div class="flex justify-between items-center gap-4">
<dt class="font-semibold text-black">{{ 'Total'|t('foster-checkout') }}:</dt>
<dt class="font-semibold text-black">{{ 'Total'|t('foster-checkout') }}</dt>
<dd class="font-semibold text-right text-black">{{ cart.totalPriceAsCurrency }}</dd>
</div>
{% endif %}
Expand Down
13 changes: 4 additions & 9 deletions src/templates/_components/app/summary-order.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<dl class="grid grid-cols-1 gap-4">

<div class="flex justify-between items-center gap-4">
<dt class="text-gray-500">{{ 'Subtotal'|t('foster-checkout') }}</dt>
<dt class="text-gray-500">{{ 'Items'|t('foster-checkout') }}</dt>
<dd class="font-semibold text-right text-black">{{ order.itemSubtotalAsCurrency }}</dd>
</div>

Expand All @@ -14,25 +14,20 @@
<dt class="text-gray-500">{{ 'Discount'|t('foster-checkout') }}</dt>
<dd class="text-right text-red-500">{{ order.totalDiscountAsCurrency }}</dd>
</div>

<div class="flex justify-between items-center gap-4">
<dt class="font-semibold text-black">{{ 'Subtotal After Discount'|t('foster-checkout') }}</dt>
<dd class="font-semibold text-right text-black">{{ order.subtotalAsCurrency }}</dd>
</div>
{% endif %}

<div class="flex justify-between items-center gap-4">
<dt class="text-gray-500">Shipping</dt>
<dt class="text-gray-500">{{ 'Shipping & handling'|t('foster-checkout') }}</dt>
<dd class="text-right text-black">{{ order.totalShippingCostAsCurrency }}</dd>
</div>

<div class="flex justify-between items-center gap-4">
<dt class="text-gray-500">Tax</dt>
<dt class="text-gray-500">{{ 'Tax'|t('foster-checkout') }}</dt>
<dd class="text-right text-black">{{ order.totalTaxAsCurrency }}</dd>
</div>

<div class="flex justify-between items-center gap-4 mt-4">
<dt class="font-semibold text-black">Total:</dt>
<dt class="font-semibold text-black">Total</dt>
<dd class="font-semibold text-right text-black">{{ order.totalPriceAsCurrency }}</dd>
</div>

Expand Down
11 changes: 6 additions & 5 deletions src/translations/en/foster-checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@
'Continue Shopping' => 'Continue Shopping',
'Country' => 'Country',
'Coupon added' => 'Coupon added',
'Coupon Code' => 'Coupon Code',
'Coupon code' => 'Coupon code',
'Date' => 'Date',
'dateFormat' => 'n/j/y',
'Decrement quantity' => 'Decrement quantity',
'Delivery Postal Code' => 'Delivery Postal Code',
'Discount' => 'Discount',
'Edit' => 'Edit',
'Email' => 'Email',
'Enter Coupon Code' => 'Enter Coupon Code',
'Enter coupon code' => 'Enter coupon code',
'Enter your email' => 'Enter your email',
'Enter your name' => 'Enter your name',
'Enter your username' => 'Enter your username',
'Estimated shipping to' => 'Estimated shipping to',
'Estimated Tax' => 'Estimated Tax',
'Estimated Total' => 'Estimated Total',
'Estimated tax' => 'Estimated tax',
'Estimated total' => 'Estimated total',
'for FREE shipping, or choose FREE Ship to Store.' => 'for FREE shipping, or choose FREE Ship to Store.',
'Full name' => 'Full name',
'Get estimated shipping' => 'Get estimated shipping',
Expand All @@ -48,6 +48,7 @@
'Item removed' => 'Item removed',
'Item updated' => 'Item updated',
'Item(s)' => 'Item(s)',
'Items' => 'Items',
'Method' => 'Method',
'Next Step' => 'Next Step',
'No Image' => 'No Image',
Expand All @@ -71,6 +72,7 @@
'Save to address book' => 'Save to your address book',
'Select' => 'Select',
'Shipping' => 'Shipping',
'Shipping & handling' => 'Shipping & handling',
'Ship to' => 'Ship to',
'Show password' => 'Show password',
'Sign In' => 'Sign In',
Expand All @@ -81,7 +83,6 @@
'Submit' => 'Submit',
'Submit a coupon code to get a discount on your order.' => 'Submit a coupon code to get a discount on your order.',
'Subtotal' => 'Subtotal',
'Subtotal After Discount' => 'Subtotal After Discount',
'Thank you for your order!' => 'Thank you for your order!',
'There are {qty} items in your cart' => 'There are {qty} items in your cart',
'to see items you might have added previously.' => 'to see items you might have added previously.',
Expand Down

0 comments on commit f0568c8

Please sign in to comment.