Skip to content

Commit

Permalink
fix: customer name concatenation (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
ankush authored Feb 28, 2022
1 parent 2584634 commit f8ac70b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ecommerce_integrations/shopify/customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import frappe
from frappe import _
from frappe.utils import validate_phone_number
from frappe.utils import cstr, validate_phone_number

from ecommerce_integrations.controllers.customer import EcommerceCustomer
from ecommerce_integrations.shopify.constants import (
Expand All @@ -21,7 +21,7 @@ def __init__(self, customer_id: str):
def sync_customer(self, customer: Dict[str, Any]) -> None:
"""Create Customer in ERPNext using shopify's Customer dict."""

customer_name = customer.get("first_name", "") + " " + customer.get("last_name", "")
customer_name = cstr(customer.get("first_name")) + " " + cstr(customer.get("last_name"))
if len(customer_name.strip()) == 0:
customer_name = customer.get("email")

Expand Down Expand Up @@ -57,7 +57,7 @@ def update_existing_addresses(self, customer):
billing_address = customer.get("billing_address", {}) or customer.get("default_address")
shipping_address = customer.get("shipping_address", {})

customer_name = customer.get("first_name", "") + " " + customer.get("last_name", "")
customer_name = cstr(customer.get("first_name")) + " " + cstr(customer.get("last_name"))
email = customer.get("email")

if billing_address:
Expand Down

0 comments on commit f8ac70b

Please sign in to comment.