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 27 Oct 2017 01:30 PM by  J T
Promotion - How to use Product Tier Discount with Coupon Code
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages


New Member


Posts:26
New Member


--
19 Oct 2017 04:04 AM

    Hi,

    I want to create a tiered discount that is only available via a coupon.

    I can see "Product - apply it to the product before add to cart" which i have used during the pre-sale of my product very well, but now I want to extend this discount by using a Coupon only.

    Can someone give me direction on how to create this as a SalesOrderDetail Promotion using a custom rule?

    M

    0


    New Member


    Posts:26
    New Member


    --
    19 Oct 2017 05:37 AM

    I have this to start. I want to take $20 off is someone purchases 2 of productVariantID 113 with the coupon code FBFLASHSALE.

    This is working but also takes $20 off if they have only 1 in the cart or any other number. Which bit is wrong?

    <xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template match="/">
    <out>
    <!--The quantity to qualify for promotion.-->
    <xsl:variable name="qualifyQty" select="2" />
    <xsl:variable name="productVariantID" select="113" />
    <discountAmount>
    <!-- Coupon code is always tested in lowercase -->
    <xsl:if test="in/salesOrder/couponCodes[couponCode = 'fbflashsale']" >
    <xsl:value-of select="-20.00" />
    </xsl:if>
    </discountAmount>
    </out>
    </xsl:template>
    </xsl:transform>
    0


    Basic Member


    Posts:394
    Basic Member


    --
    27 Oct 2017 01:30 PM

    Hi Marney,

    You set the variable but you didn't use it to compare to any data. You're missing the conditions to check bolded in red below. The example below checks if the quantity is greater or equal to your variable, which is 2. If you only want to match exactly 2 items, remove the ">" (this is escaped entity for the ">" symbol to avoid breaking the tags)

    <xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
    <out>
    <!--The quantity to qualify for promotion.-->
    <xsl:variable name="qualifyQty" select="2" />
    <xsl:variable name="productVariantID" select="113" />
    <discountAmount>
    <!-- Coupon code is always tested in lowercase -->
    <xsl:if test="in/salesOrder/couponCodes[couponCode = 'fbflashsale'] and in/this/salesOrderDetail[productVariantID = $productVariantID]/quantity >= $qualifyQty" >
    <xsl:value-of select="-20.00" />
    </xsl:if>
    </discountAmount>
    </out>
    </xsl:template>
    </xsl:transform>

    I hope this helps.

    0
    You are not authorized to post a reply.