How do I get "variant price" to display in drop down menus for products with variations?

Travis_Milne
New Member
1 0 1

I've looked all over the internet for an answer to this and we've tried for a while now to get this to work, but so far no luck.

 

I have products that have different variations available. Could be a different color or a different size or it's a different type of accessory included. Most of the time the price is the same regardless of what variation you choose, but there are instances where the price will change when you choose a different variation.

 

I initially "hand wrote" the actual product prices into the variation field, but then realized that these wouldn't update when a sale is run using "compare at price" and changing the products actual "sale price" and went through all of my variations and remove the "hand written" pricing.

 

I want ALL products that have a drop down menu for variation choices to display the actual variant price for that variant.

 

I've gone through 'product-variants.liquid' and have found the lines of code that need to be changed to get the content with the drop down menu to change, but haven't been able to get it to show the proper variant price for the unique variations for that product. I was able to accomplish it with one specific code change, but even though each unique variation displayed the proper price after the 'variant.title' - the pricing for the actual product was no longer displayed.

 

                <select class="single-option-selector single-option-selector-{{ section.id }} product-form__input form-control" id="SingleOptionSelector-{{ forloop.index0 }}" data-index="option{{ forloop.index }}">
                    {% for value in option.values %}
                        <option value="{{ value | escape }}"{% if option.selected_value == value %} selected="selected"{% endif %}>{{ value }}</option>
                    {% endfor %}
                </select>

If we take a look at the end of line 3, we have "{{ value }}" and I can add other text to the end of that string and it will show up for each variation. If I then add "- {{ variant.price | money }}" to get the variant price next to the variant title, the hyphen will show up, but not the liquid variable.

 

How can I edit the theme file to get the variant price to show next to the variant title on a drop down menu?

muhammedfayazp
New Member
5 0 0

Same problem with me

0 Likes