Forum

Thread tagged as: Question, Shop

Sale Price for specific Variant

Hi,

I am trying to apply a discount ( 20% ) on a specific variant. For instance i have Coffee products with different Weight (250gr, 500gr, 1kg) and different Grind Type (Whole beans, Espresso ground, Stove top grind).

The discount need to apply only if the user add 3 or more 1kg product with Grind Type (Whole beans or Espresso ground ).

At the moment i set up the weight and the sale_price in the product variant and in my cart template I use this code to show the sale price or the normal price:

<perch:if id="weight" match="eq" value="1000">
    <perch:if id="quantity" match="gte" value="3" >
        <perch:cartitem id="sale_price" type="shop_currency_value"/>
    <perch:else />
        <perch:cartitem id="price" type="shop_currency_value"/>
    </perch:if>
<perch:else />
    <perch:cartitem id="price" type="shop_currency_value"/>
</perch:if>

However the total doesn't update even if I use

<perch:shop id="total_items_discounted_with_tax_formatted" />

If i check "Use sale price" in product variant, then the correct total comes up.

There will be still the issue for exclude "Stove top grind" but i was thinking to check SKU inside an if statement for that.

Does anyone has a suggestion or a solution for this?

Thank you.

Vincenzo Alaia

Vincenzo Alaia 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

It sounds like you have it working - which part are you stuck with?

Hi Drew,

I am stuck because to update my total in the cart i have to check "Use sale price" in product variant. I don't want that because i would like to use the sale price only if the user select 3x1kg product and Grind Type (Whole beans or Espresso ground ).

As you know if i check "Use sale price" the price for that product will be always in sale.

Does it make sense?

Thank you.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ah ok. I don't know of a way to do that.