Regular Price and Sale Price - Conditional Logic - If not sale, hide sale Price field

Hello,
I’m using Wordpress Version 6.5.5
Cornerstone Version 6.4.22

I’m creating a WooCommerce store, and I want to create two fields for the prices.
Field 1 - Regular Price;

${{dc:woocommerce:product_regular_price}}

Field 2 - Sale Price

{{dc:woocommerce:product_sale_price}}.

But, I want to hide Field 2 (Sale Price) in case the user doesn’t add a Sale Value to the Product.

I have tried using conditional logic, but I had no success. I would appreciate any help.

Best,
Diego

Hello Diego,

Thanks for writing in!

You will need to use {{dc:woocommerce:product_price}} for the product price. This will also display the Sale Price.

Insert another Text element before the product price and use {{dc:woocommerce:product_regular_price}}. You can the “Decoration” to Line Through under the Text Format settings and add a condition Product(is) IS On Sale.

The final layout will look like this:

Hope this makes sense.

That works perfectly. This is a much cleaner solution compared to what I did using JS and CSS.

Much appreciate.

You are most welcome, Diego.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.