Skip to main content
All CollectionsNexternalStore Design, Mechanics & Testing / Site Sync / Store URL
Nexternal: Display Nexternal Cart Information on Your Website Pages
Nexternal: Display Nexternal Cart Information on Your Website Pages

Display cart information on pages not hosted by TrueCommerce/Nexternal

Pamela Topper avatar
Written by Pamela Topper
Updated over 3 years ago

Product: Nexternal

Following is some sample code to get you started, and you can style it however you'd like:
------------------------------------------------------------------------------------------
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- NOTE: REPLACE https://store.firstfairway.com/cartcontents.js BELOW WITH https://store.nexternal.com/AccountName/cartcontents.js (or https://DomainAlias/cartcontents.js if you have specified a Domain Alias at Settings/Site Options in the Order Management System).-->


<script src="https://store.firstfairway.com/cartcontents.js"></script>
<script>
$( document ).ready(function() {
if(cartProperties.QuantityTotal == 0) {
$('.cartInfo').html('Your Shopping Cart is Empty.');
} else {
$('.cartQuantity').html(cartProperties.QuantityTotal);
if(cartProperties.QuantityTotal > 1){$('.item').html('items')};
$('.currencySymbol').html(cartProperties.CurrencySymbol);
$('.cartTotal').html(cartProperties.GrandPriceTotal);
}

if(customerProperties.FirstName == null){
$('.hello').hide();
} else {
$('.firstName').html(customerProperties.FirstName);
$('.lastName').html(customerProperties.LastName);
}



});
</script>
<span class="hello">Hello <span class="firstName"></span> <span class="lastName"></span>.</span> <span class="cartInfo">You have <span class="cartQuantity"></span> <span class="item">item</span> in your cart totaling <span class="currencySymbol"></span><span class="cartTotal"></span>.</span>

------------------------------------------------------------------------------------------
IMPORTANT NOTES:

1. You can find all the available variables by loading this file in your browser: https://store.nexternal.com/AccountName/cartcontents.js (or https://DomainAlias/cartcontents.js if you have specified a Domain Alias at Settings /Site Options in the Order Management System (OMS)).

2. For this to continue to work properly you must have an Always Secure store. If you are NOT using a domain alias, this means simply checking the Always Secure box in your OMS at Settings / Site Options. However, it is optimal to use a domain alias, and if you ARE using a domain alias, you will need to request a Secure Domain Alias (small annual charge applies) and then check the Always Secure box after the Secure Domain Alias has been set up for you (Settings / Site Options).

rev: 1/4/21

Did this answer your question?