Changing code so it doesnt have from in shown price

Hi,

I have the Sense theme and I want to change the coding so my product doesn’t have the “from lower price variant”. I want it to show the higher price of my variants. I’ve figured out that it is this line of code:

if target == product and product.price_varies> assign money_price = ‘products.product.price.from_price_html’ | t: price: money_price> endif> -%}

If you could help me figure out what to replace this with that would be great.

Thanks

Hi @GG_soaps

Thank you for reaching out to the Shopify community.

To change the code in the Sense theme so that it displays the higher price of your variants instead of the “from lower price variant,” you can make the following modification:

I beleive you have figured out where you have to make the the modification

replace:-

if target == product and product.price_varies
  assign money_price = 'products.product.price.from_price_html' | t: price: money_price
endif

with:-

if target == product and product.price_varies
   assign highest_price = product.variants | sort: 'price' | last
    assign money_price = highest_price.price | money
    if settings.currency_code_enabled
      assign money_price = highest_price.price | money_with_currency
    endif
endif

Save the modified file and test it on your store to see the changes.

Do give it a try and let me know if this was helpful.

Thanks.

Hi!

Yes, that worked. Thank you so much!