Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit a3ae38e

Browse files
committed
Add "you don't have any saved addresses" message to the item page under "this product can ship to you in these countries" section if the user doesn't have any addresses yet.
1 parent 31b2dbb commit a3ae38e

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

js/languages/en-US.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
"CountryOfOrigin": "Country of Origin:",
123123
"CanBeShippedTo": "Can Ship to You In:",
124124
"NoShippableAddress": "None of your saved addresses are in a country this listing can be shipped to.",
125+
"NoSavedAddresses": "You don't have any saved addresses yet.",
125126
"Addresses": "Addresses",
126127
"Files": "Files",
127128
"NewAddress": "New Address",

js/templates/item.html

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,20 @@ <h4><%= polyglot.t('CanBeShippedTo') %></h4>
127127
</div>
128128
<div class="marginBottom20 marginLeft7 row10">
129129
<% var matchedItemShippableCountries = _.uniq(_.intersection(_.pluck(ob.userAddresses, 'country'), ob.vendor_offer.listing.shipping.shipping_regions));
130-
if(matchedItemShippableCountries.length > 0){
131-
_.each(matchedItemShippableCountries, function(data){
132-
print("<p>" + polyglot.t(`countries.${data}`) + "</p>");
133-
});
134-
} else if(!ob.worldwide){
135-
print(polyglot.t('NoShippableAddress'));
130+
if(ob.userAddresses.length > 0) {
131+
if(matchedItemShippableCountries.length > 0){
132+
_.each(matchedItemShippableCountries, function(data){
133+
print("<p>" + polyglot.t(`countries.${data}`) + "</p>");
134+
});
135+
} else if(!ob.worldwide){
136+
print(polyglot.t('NoShippableAddress'));
137+
} else {
138+
_.each(_.uniq(_.pluck(ob.userAddresses, 'country')), function(data){
139+
print("<p>" + polyglot.t(`countries.${data}`) + "</p>");
140+
});
141+
}
136142
} else {
137-
_.each(_.uniq(_.pluck(ob.userAddresses, 'country')), function(data){
138-
print("<p>" + polyglot.t(`countries.${data}`) + "</p>");
139-
});
143+
print(polyglot.t('NoSavedAddresses'));
140144
}
141145
%>
142146
</div>

0 commit comments

Comments
 (0)