Woocommerce DC regular price wrong when on sale

I know we are not active on beta testing right now, but I’ll put this here so you see it when on your next round.

I didn’t get time to test properly before release, but just playing around with a WooCommerce setup and single product layouts right now.

Note: This only occurs with variable products - for simple products it works as expected

There seems to be a bug when a product is on sale. Where on the front end it should use dc:woocommerce:product_price and dc:woocommerce:product_regular_price with the regular price formatted as strikeout. Both values are showing as the same (as the discounted price).

Thanks @spedney,

Appreciate you reaching out about this. I have some notes on this so we can investigate it but unfortunately, I’m not sure just when we’ll be able to address this. Dynamic Content and the Layout builder aren’t fully equipped to handle Variable Products in all situations.

Thanks,
I did find a solution to it by doing a bit of custom code. I can’t remember how I did it now though as it was awhile back. I know there’s lots of things to do all the time, But it seems that you’re getting lots and lots of improvement on every step of your roadmap. Woocommerce seems to be something that more and more people are wanting to find ways to customise. I’ve managed to avoid it pretty much up until the last month or so, so I’ve only just noticed the things that are lacking. I know we’ll get there in the end, and thanks for all the good stuff you’re bringing to Pro!

Thank you! Glad to hear you had it working. I tweaked something recently with how WooCommerce Dynamic Content retrieves product information. Previously, it would use get_the_ID to locate the current product. We’ve updated it to global $product; $id = $product->id; and only fallback to get_the_ID` if a product isn’t in scope. This means when Dynamic Content runs, it’s more accurate the the actual product in scope. I’ve not tested this against some of the variable product use cases we have recorded, but it it could help iron some of these odd issues out.

I think I ended up writing a little shortcode to return:
$price = wc_get_price_to_display( $product, array( 'price' => $product->get_variation_regular_price() ) );

Instead of using: dc:woocommerce:product_regular_price

Gotcha! Thanks for sharing this.