On my website I am adding a clear cart button usin...
# suitecommerce
b
On my website I am adding a clear cart button using the special url <yourdomain.com>/app/site/backend/emptycart.nl. The problem I am running into though, is that I don't want to hardcode <yourdomain.com> because I might be using sandbox or I might be using production. Currently I am adding the button in Theme Development. Is there an easy way to dynamically determine what domain I am on in the theme, without adding an extension?
d
Can you not just use a relative URL without the domain?
b
That was the first thing I tried, but it only worksthe url if I use the full one; or open a new tab
d
Tried an onclick? ie. <button onclick="window.location.href='/app/site/backend/emptycart.nl'">Empty</button>
s
container.getComponent('Environment').getSiteSetting('touchpoints').home
b
Thanks!
What would the touchpoint and hashtag be for empty cart?
s
Neither of things apply with the endpoint you are using
emptycart.nl is vestigial from Site Builder
So, as Dominic says, you can either just hit /app/site/backend/emptycart.nl directly or tack on the home touchpoint before requesting it
Afterwards the server will automatically reroute the page to goToCart.ssp
(Another vestigial part of Site Builder)
b
How do you tack on the home touchpoint?
s
container.getComponent('Environment').getSiteSetting('touchpoints').home + '/app/site/backend/emptycart.nl'
b
Can I do that in a template?
s
In a template, it would be better to just set the
href
to
/app/site/backend/emptycart.nl
or do what Dominic suggested
b
Ok, thanks