Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Product meta lookup table incorrectly shows product on sale #43008

Closed
5 tasks done
pintend opened this issue Dec 20, 2023 · 0 comments · Fixed by #43011
Closed
5 tasks done

Product meta lookup table incorrectly shows product on sale #43008

pintend opened this issue Dec 20, 2023 · 0 comments · Fixed by #43011
Labels
focus: product Issues related to product or product page. team: Mothra type: community contribution

Comments

@pintend
Copy link
Contributor

pintend commented Dec 20, 2023

Prerequisites

  • I have carried out troubleshooting steps and I believe I have found a bug.
  • I have searched for similar bugs in both open and closed issues and cannot find a duplicate.

Describe the bug

If i product has its _sale_price and _regular_price the same then _price will also be the same. $product->is_on_sale() will correctly return false as it checks against the regular price but the lookup table will show on sale as it ignores the regular price and just checks if the _price is the same as the _sale_price

It may be incorrect to have all 3 prices be the same, but it can happen and it will cause this behavior. In my case its not in my control as we are working with a company which integrates our products/inventory with another system (which is where prices are configured) I have an issue opened with them as well to not populate the _sale_price meta field when its the same. but regardless i think this should also be fixed here

Expected behavior

wp_wc_product_meta_lookup.onsale should be 0 when $product->is_on_sale() is false

Actual behavior

wp_wc_product_meta_lookup.onsale can sometimes be 1 when $product->is_on_sale() is false

Steps to reproduce

set regular_price, price, and sale_price to the same value and generate lookup tables`

WordPress Environment

N/A

Isolating the problem

  • I have deactivated other plugins and confirmed this bug occurs when only WooCommerce plugin is active.
  • This bug happens with a default WordPress theme active, or Storefront.
  • I can reproduce this bug consistently using the steps above.
@jonathansadowski jonathansadowski added focus: product Issues related to product or product page. team: Mothra labels Dec 20, 2023
jorgeatorres added a commit that referenced this issue Mar 1, 2024
…sale Closes #43008 (#43011)

* Update wc-product-functions.php

Determine if a product is on sale based on regular price, which is how its done in the WC_Product class https://github.com/woocommerce/woocommerce/blob/7122669d448acb90d0f8a7177b76baaccec2e76b/plugins/woocommerce/includes/abstracts/abstract-wc-product.php#L1633

* Add changefile(s) from automation for the following project(s): woocommerce

* added missing placeholders

* Update 43011-patch-1

* Add changefile(s) from automation for the following project(s): woocommerce

* Re-trigger CI

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Jorge A. Torres <jorge.torres@automattic.com>
thealexandrelara pushed a commit that referenced this issue Mar 4, 2024
…sale Closes #43008 (#43011)

* Update wc-product-functions.php

Determine if a product is on sale based on regular price, which is how its done in the WC_Product class https://github.com/woocommerce/woocommerce/blob/7122669d448acb90d0f8a7177b76baaccec2e76b/plugins/woocommerce/includes/abstracts/abstract-wc-product.php#L1633

* Add changefile(s) from automation for the following project(s): woocommerce

* added missing placeholders

* Update 43011-patch-1

* Add changefile(s) from automation for the following project(s): woocommerce

* Re-trigger CI

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Jorge A. Torres <jorge.torres@automattic.com>
Konamiman pushed a commit that referenced this issue Mar 13, 2024
…sale Closes #43008 (#43011)

* Update wc-product-functions.php

Determine if a product is on sale based on regular price, which is how its done in the WC_Product class https://github.com/woocommerce/woocommerce/blob/7122669d448acb90d0f8a7177b76baaccec2e76b/plugins/woocommerce/includes/abstracts/abstract-wc-product.php#L1633

* Add changefile(s) from automation for the following project(s): woocommerce

* added missing placeholders

* Update 43011-patch-1

* Add changefile(s) from automation for the following project(s): woocommerce

* Re-trigger CI

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Jorge A. Torres <jorge.torres@automattic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: product Issues related to product or product page. team: Mothra type: community contribution
Projects
None yet
2 participants