NO BUG: Product price in query loop

Browser: Chrome (new)
OS: macOS / Windows / Linux / etc.
URL: Link to a page that illustrates this issue

Hi bricks team,

When we use the product price element in the query loop, if the product has a sale price, the product price will have 11 DOM element.
But if we use sale price and regular price dynamic data, the DOM element will be reduced to 6 items. But using sale price and regular price in an element like heading 3 is problematic.

1- It does not display the price of variable products.

2- We cannot differentiate between sale price and regular price styles. For example, I set a strikethrough for the previous price (on sale products). But the prices of products that are not on sale and have only one price will also have strikethrough.

3- When we put sale price and regular price inside an element like heading, the h tag is still rendered. While it can be removed to have a cleaner code, please pay attention to the following example.

Currently:

<h3 class="brxe-sxlonw brxe-heading">
<span class="woocommerce-Price-amount amount">
<span class="woocommerce-Price-currencySymbol">$</span>65</span>
</h3>

optimal

<span class="woocommerce-Price-amount amount">
<span class="woocommerce-Price-currencySymbol">$</span>65</span>

I hope there is a way to improve these things. thanks!

Hi Jolia,
Thanks for your report!

  1. The price element displays the variable price range (default behavior).
  2. You can. However, the strikethrough setting isn’t even needed for the sale price, since the del HTML tag already uses strike/line through.
  3. I don’t understand. Why do you wrap the element with a tag you don’t want?

Overall, it’s again the default WooCommerce behavior and markup. As I mentioned multiple times, please compare it with a default theme such as Storefront (in the best case, before creating a bug report).

Thanks for your understanding!
Best regards,
timmse

1 Like

I don’t understand. Why do you wrap the element with a tag you don’t want?

Hi timmse,

If we put a dynamic data inside an element like heading, it will be like this.

<h3 class="brxe-sxlonw brxe-heading">
<span class="woocommerce-Price-amount amount">
<span class="woocommerce-Price-currencySymbol">$</span>65</span>
</h3>

Yes, because that’s what {woo_product_regular_price} renders, regardless if it’s wrapped or not.

If you want to get rid of the html, use the :plain filter: {woo_product_regular_price:plain}

1 Like