Forum

The forum is a free service supported by community members. Please consider opening a support ticket if you need timely help.

PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 09 Dec 2022 02:19 AM by  Michael Tyson
Dollar Amount Discount based on Cart Value
 4 Replies
Sort:
You are not authorized to post a reply.
Author Messages


New Member


Posts:49
New Member


--
26 Nov 2022 08:35 AM

    Wodering if its possible to create a cart dollar value discount to the Shopping cart where a spend value is reached

    Example   Shopping cart exceeds $200.00 a flat rate discount of $20.00 is applied.

     

    0


    Veteran Member


    Posts:2951
    Veteran Member


    --
    06 Dec 2022 09:46 PM

    Yes, just create a promotion rule and select type "Sales Order Detail". Then choose "Custom rule" and from the New from template, choose the "Flat discount if exceed amt". Change the desired values. In the example template, it shows the amount (100 for purchases exceeding $100 dollars) and the discount to apply (-0.10 means discount by -10%).

     

    0


    New Member


    Posts:49
    New Member


    --
    08 Dec 2022 07:08 AM

    Thank you

    I did see that but I want to discount by a fixed dollar amount not a percentage.

    This way I can limit the amount of discount. What would be the change in the code to discount by say $20.00 for any order over $100.00

    0


    Veteran Member


    Posts:2951
    Veteran Member


    --
    08 Dec 2022 05:18 PM

    You can modify the rule like this. Just change the variable values.

    <xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:template match="/">
        <out>
          <discountAmount>
            <!-- Sum up all the sales order details amount and test if exceeds $100 to give a fixed discount of $10 -->
            <xsl:variable name="subTotal" select="sum(in/salesOrder/salesOrderDetails/salesOrderDetail/amount)" />
            <xsl:variable name="minSpend" select="100" />
            <xsl:variable name="fixedDiscount" select="10" />
              
            <xsl:if test="$subTotal &gt; $minSpend" >
              <xsl:value-of select="-1 * $fixedDiscount * in/this/salesOrderDetail/amount div $subTotal" />
            </xsl:if>
          </discountAmount>
        </out>
      </xsl:template>
    </xsl:transform>

    0


    New Member


    Posts:49
    New Member


    --
    09 Dec 2022 02:19 AM

    Thank you Steve

    This is exactly what I need

    0
    You are not authorized to post a reply.