Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent error in cartPayerName helper if buyer name contains non-latin characters. #1432

Merged
merged 1 commit into from
Sep 30, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions imports/plugins/core/checkout/client/helpers/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,10 @@ Template.registerHelper("cart", function () {
* @summary gets current cart billing address / payment name
* @return {String} returns cart.billing[0].fullName
*/

Template.registerHelper("cartPayerName", function () {
const cart = Cart.findOne();
if (cart) {
if (cart.billing) {
if (cart.billing[0].address) {
if (cart.billing[0].address.fullName) {
return cart.billing[0].address.fullName;
}
}
}
if (cart && cart.billing && cart.billing[0] && cart.billing[0].address && cart.billing[0].address.fullName) {
const name = cart.billing[0].address.fullName;
if (name.replace(/[a-zA-Z ]*/, "").length === 0) return name;
}
});