Symptoms
- The product page shows one price and the cart another
- Discounts apply twice or not at all
- Variable products show the wrong price range
- Prices are right for you but wrong for customers
Why it happens
WooCommerce calculates and shows prices in several places: the product page, the shop list, the cart and the checkout. Custom code has to change the price in the right place, or the numbers stop matching.
AI-written snippets often change only the displayed price, or only one product type. WooCommerce also stores some price ranges for variable products, so old values can stick around after a code change.
Try this first
-
Find the code that changes prices
Search your theme and custom plugins for price-related hooks.
grep -rn "woocommerce_product_get_price\|woocommerce_get_price_html\|woocommerce_before_calculate_totals" wp-content/themes wp-content/plugins/your-plugin -
Check where the price is changed
Changing woocommerce_get_price_html only changes what people see, not what they pay. Real price changes belong in the price getters or in the cart calculation.
// Display only. The cart still uses the original price. add_filter( 'woocommerce_get_price_html', 'my_price_label', 10, 2 ); // Changes the price used in the cart. add_action( 'woocommerce_before_calculate_totals', function ( $cart ) { if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { return; } foreach ( $cart->get_cart() as $item ) { // set the new price with $item['data']->set_price( ... ) } } ); -
Cover variable products
Variations use their own hooks, like woocommerce_product_variation_get_price. Code that only handles simple products leaves variations unchanged.
-
Clear stored prices
Go to WooCommerce, Status, Tools and clear transients, then clear your site cache. Old variation price ranges are often stored there.
-
Test as a customer
In a private window, add products to the cart, apply coupons and go to checkout. Compare every price with what you expect.
When to stop and call a person
Get a developer fast if customers are paying the wrong amount. Price bugs cost money with every order, and fixing them usually means reading all the custom price code together, not one snippet at a time.
Questions people ask
Can I use a plugin instead of custom code?
Often yes. Dynamic pricing and discount plugins cover most common rules and are tested by many stores.
Why are prices right for me but not for customers?
Common causes are caching, role-based price code or code that only runs when you are logged in as admin.