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

Don't show saving badge if the value is negative #2955

Merged
merged 1 commit into from Aug 5, 2020

Conversation

senadir
Copy link
Member

@senadir senadir commented Aug 4, 2020

Fixes a case in which having the current price higher than the regular price causes the cart to show negative savings.

Fixes #2627

Screenshots

Before:
image

After:
image

How to test the changes in this Pull Request:

I didn't know how to reproduce using native WooCommerce features, you will need Product Add-ons extension.

  1. Add a product with a priced add on.
  2. Add the product to your cart, with the add on enabled.
  3. See that the price is shown without a negative discount value.

Changelog

Hide the discount badge from Cart items if the value is negative.

@senadir senadir added type: bug The issue/PR concerns a confirmed bug. block: cart Issues related to the cart block. labels Aug 4, 2020
@senadir senadir added this to the 3.2.0 milestone Aug 4, 2020
@senadir senadir requested a review from Aljullu August 4, 2020 13:44
@senadir senadir requested a review from a team as a code owner August 4, 2020 13:44
@senadir senadir self-assigned this Aug 4, 2020
@senadir senadir removed the request for review from a team August 4, 2020 13:44
@github-actions
Copy link
Contributor

github-actions bot commented Aug 4, 2020

Size Change: +10 B (0%)

Total Size: 1.65 MB

Filename Size Change
build/cart-frontend.js 66 kB +6 B (0%)
build/cart.js 34.5 kB +4 B (0%)
ℹ️ View Unchanged
Filename Size Change
build/active-filters-frontend.js 8.49 kB 0 B
build/active-filters.js 8.77 kB 0 B
build/all-products-frontend.js 30.9 kB 0 B
build/all-products.js 35.3 kB 0 B
build/all-reviews-legacy.js 9.38 kB 0 B
build/all-reviews.js 9.7 kB 0 B
build/atomic-block-components/add-to-cart-frontend.js 8.73 kB 0 B
build/atomic-block-components/add-to-cart.js 7.32 kB 0 B
build/atomic-block-components/add-to-cart~atomic-block-components/button.js 3.12 kB 0 B
build/atomic-block-components/add-to-cart~atomic-block-components/image~atomic-block-components/title.js 334 B 0 B
build/atomic-block-components/button-frontend.js 1.99 kB 0 B
build/atomic-block-components/button.js 839 B 0 B
build/atomic-block-components/category-list-frontend.js 469 B 0 B
build/atomic-block-components/category-list.js 476 B 0 B
build/atomic-block-components/image-frontend.js 1.7 kB 0 B
build/atomic-block-components/image.js 1.15 kB 0 B
build/atomic-block-components/price-frontend.js 2.08 kB 0 B
build/atomic-block-components/price.js 2.11 kB 0 B
build/atomic-block-components/rating-frontend.js 524 B 0 B
build/atomic-block-components/rating.js 527 B 0 B
build/atomic-block-components/sale-badge-frontend.js 862 B 0 B
build/atomic-block-components/sale-badge.js 864 B 0 B
build/atomic-block-components/sku-frontend.js 388 B 0 B
build/atomic-block-components/sku.js 394 B 0 B
build/atomic-block-components/stock-indicator-frontend.js 568 B 0 B
build/atomic-block-components/stock-indicator.js 571 B 0 B
build/atomic-block-components/summary-frontend.js 919 B 0 B
build/atomic-block-components/summary.js 926 B 0 B
build/atomic-block-components/tag-list-frontend.js 464 B 0 B
build/atomic-block-components/tag-list.js 473 B 0 B
build/atomic-block-components/title-frontend.js 1.22 kB 0 B
build/atomic-block-components/title.js 1.05 kB 0 B
build/attribute-filter-frontend.js 17.8 kB 0 B
build/attribute-filter.js 12.3 kB 0 B
build/blocks-legacy.js 3.54 kB 0 B
build/blocks.js 3.54 kB 0 B
build/checkout-frontend.js 83 kB 0 B
build/checkout.js 39.9 kB 0 B
build/editor-legacy-rtl.css 13.8 kB 0 B
build/editor-legacy.css 13.8 kB 0 B
build/editor-rtl.css 14 kB 0 B
build/editor.css 14 kB 0 B
build/featured-category-legacy.js 7.28 kB 0 B
build/featured-category.js 7.65 kB 0 B
build/featured-product-legacy.js 9.53 kB 0 B
build/featured-product.js 9.89 kB 0 B
build/handpicked-products-legacy.js 6.93 kB 0 B
build/handpicked-products.js 7.29 kB 0 B
build/price-filter-frontend.js 14.2 kB 0 B
build/price-filter.js 10.2 kB 0 B
build/product-best-sellers-legacy.js 7.01 kB 0 B
build/product-best-sellers.js 7.36 kB 0 B
build/product-categories-legacy.js 3.23 kB 0 B
build/product-categories.js 3.23 kB 0 B
build/product-category-legacy.js 7.93 kB 0 B
build/product-category.js 8.31 kB 0 B
build/product-new-legacy.js 7.17 kB 0 B
build/product-new.js 7.53 kB 0 B
build/product-on-sale-legacy.js 7.55 kB 0 B
build/product-on-sale.js 7.92 kB 0 B
build/product-search-legacy.js 3.15 kB 0 B
build/product-search.js 3.48 kB 0 B
build/product-tag-legacy.js 6.1 kB 0 B
build/product-tag.js 6.44 kB 0 B
build/product-top-rated-legacy.js 7.14 kB 0 B
build/product-top-rated.js 7.5 kB 0 B
build/products-by-attribute-legacy.js 7.91 kB 0 B
build/products-by-attribute.js 8.24 kB 0 B
build/reviews-by-category-legacy.js 11.4 kB 0 B
build/reviews-by-category.js 11.7 kB 0 B
build/reviews-by-product-legacy.js 12.8 kB 0 B
build/reviews-by-product.js 13.3 kB 0 B
build/reviews-frontend-legacy.js 8.22 kB 0 B
build/reviews-frontend.js 9.08 kB 0 B
build/single-product-frontend.js 33.7 kB 0 B
build/single-product.js 10 kB 0 B
build/style-legacy-rtl.css 16.8 kB 0 B
build/style-legacy.css 16.8 kB 0 B
build/style-rtl.css 17.5 kB 0 B
build/style.css 17.5 kB 0 B
build/vendors-legacy.js 367 kB 0 B
build/vendors-style-legacy-rtl.css 1.03 kB 0 B
build/vendors-style-legacy.css 1.03 kB 0 B
build/vendors-style-rtl.css 1.03 kB 0 B
build/vendors-style.css 1.03 kB 0 B
build/vendors.js 416 kB 0 B
build/vendors~atomic-block-components/price-frontend.js 5.65 kB 0 B
build/wc-blocks-data.js 7.09 kB 0 B
build/wc-blocks-middleware.js 931 B 0 B
build/wc-blocks-registry.js 2.28 kB 0 B
build/wc-payment-method-bacs.js 790 B 0 B
build/wc-payment-method-cheque.js 796 B 0 B
build/wc-payment-method-cod.js 875 B 0 B
build/wc-payment-method-paypal.js 831 B 0 B
build/wc-payment-method-stripe.js 11.9 kB 0 B
build/wc-settings.js 2.14 kB 0 B
build/wc-shared-context.js 1.53 kB 0 B
build/wc-shared-hocs.js 1.66 kB 0 B

compressed-size-action

Copy link
Contributor

@Aljullu Aljullu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is testing great and code looks good! :shipit:

@senadir senadir merged commit 834667c into main Aug 5, 2020
@senadir senadir deleted the fix/hide-saving-if-is-negative branch August 5, 2020 10:28
@senadir senadir mentioned this pull request Aug 19, 2020
20 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
block: cart Issues related to the cart block. type: bug The issue/PR concerns a confirmed bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Override default display of savings in the cart detail table if savings are _negative_
3 participants