Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Method Name

Signature

Returns

Example

getReturnLink

#set($myReturnLink = $cart.getReturnLink())

a bitly url useful for directing a customer back to their checkout.

#if("$!{cart}" != "") ## <-- better way to check for nulls instead of

## The above line is preferred to just #if($cart)
Please complete your order! Here's a 20% off coupon that is good for the next 48 hours!
#set($cCode = $coupon.generateCode('MY_20_OFF', '48'))
$cart.addUniqueCouponCode($cCode)
#set($returnLink = $cart.getReturnLink())
<a href="${returnLink}">Your Order</a>
#end

## no indentations above if this is inside the text email, or indentations will show in final output!

getReturnLink

getReturnLink(String returnUrl, String tokenParameter)

#set($myReturnLink = $cart.getReturnLink("www.myjavascriptcheckout.com/checkout.html", "returnCode")

a bitly url useful for directing a customer back to their custom checkout.#if("$!{cart}" != "") ## <-- better way to check for nulls instead of #if($cart)
Please complete your order! Here's a 20% off coupon that is good for the next 48 hours!
 #set($cCode = $coupon.generateCode('MY_20_OFF', '48'))
 $cart.addUniqueCouponCode($cCode)
 #set($returnLink = $cart.getReturnLink("www.myjavascriptcheckout.com/checkout.html", "returnCode"))
<a href="${returnLink}">Your Order</a>
 #end

addUniqueCouponCode

$cart.addUniqueCouponCode($code)

true if successful, else false. If false, $cart.getErrors() will contain a list of errors.

see getReturnLink for example

setReturnUrl
alternative way to use custom return linkif you setReturnUrl and setTokenParameterName, then the getReturnLink() with empty parameters will also return a custom link. This is mainly going to be used with External Integrations such as Lyris. If you're not using Lyris, then getReturnLink(returnUrl, tokenName) is simpler and preferred.
setTokenParameterName
alternative way to use custom return link

...