Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Show total sale badge in medium carts & make it display below price #3879

Merged
merged 7 commits into from
Feb 23, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions assets/js/blocks/cart-checkout/cart/full-cart/cart-line-item-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,22 +256,24 @@ const CartLineItemRow = ( { lineItem = {} } ) => {
</div>
</td>
<td className="wc-block-cart-item__total">
<ProductPrice
currency={ totalsCurrency }
format={ productPriceFormat }
price={ totalsPrice.getAmount() }
/>

{ quantity > 1 && (
<ProductSaleBadge
currency={ priceCurrency }
saleAmount={ getAmountFromRawPrice(
saleAmount,
priceCurrency
) }
format={ saleBadgePriceFormat }
<div className="wc-block-cart-item__total-price-and-sale-badge">
<ProductPrice
currency={ totalsCurrency }
format={ productPriceFormat }
price={ totalsPrice.getAmount() }
/>
) }

{ quantity > 1 && (
<ProductSaleBadge
currency={ priceCurrency }
saleAmount={ getAmountFromRawPrice(
saleAmount,
priceCurrency
) }
format={ saleBadgePriceFormat }
/>
) }
</div>
</td>
</tr>
);
Expand Down
22 changes: 18 additions & 4 deletions assets/js/blocks/cart-checkout/cart/full-cart/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,24 @@ table.wc-block-cart-items {
display: flex;
}

.wc-block-cart-item__total-price-and-sale-badge {
display: flex;
flex-direction: column;
align-items: flex-end;

.wc-block-components-sale-badge {
margin-top: $gap-smallest;
}
}

.is-small {
opr marked this conversation as resolved.
Show resolved Hide resolved
.wc-block-cart-item__total {
.wc-block-components-sale-badge {
display: none;
}
}
}

.is-medium,
.is-small,
.is-mobile {
Expand Down Expand Up @@ -202,10 +220,6 @@ table.wc-block-cart-items {
.wc-block-components-formatted-money-amount {
display: inline-block;
}

.wc-block-components-sale-badge {
display: none;
}
}
}
}
Expand Down