-
Notifications
You must be signed in to change notification settings - Fork 219
Show total sale badge in medium carts & make it display below price #3879
Conversation
Size Change: +97 B (0%) Total Size: 1.15 MB
ℹ️ View Unchanged
|
This solution works but I see that ProductPrice has this class and there might be cases where it's needed to be inline. What we could do is style locally, depending on the need. So I am thinking of wrapping the price and disscount in a div and setting that as a flex container, with a column direction (style is inline for demo purpose only): <td class="wc-block-cart-item__total">
<div style="
display: flex;
flex-direction: column;
align-items: flex-end;
">
<span class="price wc-block-components-product-price">...</span>
<div class="wc-block-components-product-badge wc-block-components-sale-badge">...</div>
</div>
</td> This way the elements will display correctly here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know what you think of the proposal to handle the display locally.
Thanks for the review @ralucaStan I've made the change you suggested, I would like to hear your thoughts on my choice of class name, |
@opr how about |
…3879) * Show total sale badge in medium carts * Add markup to cart line item row to enable it to be displayed as flex * Add styling to display price and sale badge as flex * Revert product price being displayed as block * Rename sale badge and price wrapper * Hide line-total sale badge on mobile * Change class name on total price and sale badge wrapper again
When the price and sale badge are short, they appear on the same line. During testing, the product sale badge was usually long enough to cause it to break onto a new line so this went unnoticed.
By setting the class
.wc-block-components-product-price
to be block it ensures the badge will always display below the price.I also noticed that the sale badge didn't display when the block size was medium, so I have allowed it to display there. This was especially noticeable in the TwentyTwenty theme when the block size is always medium.
Screenshots
Before
After
How to test the changes in this Pull Request:
feature/checkout-block-simple-multiple-subscriptions
) then add a subscription product that's on sale, too.Changelog