L
L
Lev Rozanov2018-04-07 21:04:05
WordPress
Lev Rozanov, 2018-04-07 21:04:05

How to display price in WooCommerce variable product dropdown list?

Good day!
There are variable products, the names are displayed in a drop-down list and the price of the product variant appears below.
I would like to display the cost next to the name i.e. in the options select.
Google tormented, no answer. There are some options for older versions of WC, but with scripts and a direct query to the database.
Example like now

<select>
<option>Черный</option>
<option>Белый</option>
</select>

As you would like:
<select>
<option>Черный - 100 руб.</option>
<option>Белый - 200 руб.</option>
</select>

In the variable options output file (variable.php), the function is responsible for the output wc_dropdown_variation_attribute_options.
But in the documentation , there is no normal explanation of the options, or I misunderstand something.
Please help me figure it out.
Thanks in advance.
UPD: Solution needed for latest version of WooCommere

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem, 2018-04-07
@Skmlnv

Details on your question: https://codelight.eu/adding-price-product-options-...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question