Hi Kenyatta
The Storefront is Avalara certified for tax compliance. In normal accounting practice, a discount needs to be subtracted from something materially sold so that the appropriate tax due can be calculated for each product sold against its net final price after discount. This makes sense for the same reason you can't give a $50 discount if the user buys less than $50 as it will come to a negative total. A easy way is to check the order exceeds $50 subtotal and simply split the $50 discount proportionally to each sales order detail amount relative to the subtotal.
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="/">
<out>
<xsl:variable name="SubTotalExclDiscounts" select="sum(in/salesOrder/salesOrderDetails/salesOrderDetail/amount)"/>
<xsl:if test="in/salesOrder/couponCodes[couponCode = 'free2'] and $SubTotalExclDiscounts &gt; 50">
<discountAmount>
<xsl:value-of select="-50 * (/in/this/salesOrderDetail/amount div $SubTotalExclDiscounts)"/>
</discountAmount>
</xsl:if>
</out>
</xsl:template>
</xsl:transform>