Need a quick edit to change variant prices and how they show up

@tim_1
Sat, 25 Apr 2026 14:55:19 +0000

You need to make sure that this snippet is only used on product cards in collection.

Many themes use the same snippet for the product page as well in which case the edit suggested above would not work properly on product page.

I’d be approaching it rather like this – instead of:

{%- liquid
     if use_variant
        assign target = product.selected_or_first_available_variant
    else
        assign target = product
    endif

    assign compare_at_price = target.compare_at_price
    assign price = target.price | default: 1999

I’d try this:

{%- liquid

    assign price  = product.selected_or_first_available_variant.price | default: 1999
    assign compare_at_price = product.selected_or_first_available_variant.compare_at_price

    if use_variant
        assign target = product.selected_or_first_available_variant
    else
        assign target = product
    endif

This way, if no variant is selected, the code will output price of first available variant, rather then the cheapest, which can be unavailable.