Skip to content

Commit

Permalink
fix: Save customer address
Browse files Browse the repository at this point in the history
  • Loading branch information
acasazza committed Mar 29, 2022
1 parent 70014b2 commit 4161a3c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/components/BillingAddressForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ const BillingAddressForm: React.FunctionComponent<BillingAddressFormProps> = (
isBusiness
)
if (!mandatory) delete values[name]
if (field?.value || field?.required === false) {
if (
field?.value ||
(field?.required === false && field?.type !== 'checkbox')
) {
values[name.replace('billing_address_', '')] = field.value
delete values[name]
}
Expand Down
5 changes: 4 additions & 1 deletion src/components/ShippingAddressForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ const ShippingAddressForm: FunctionComponent<ShippingAddressFormProps> = (
isBusiness
)
if (!mandatory) delete values[name]
if (field?.value || field?.required === false) {
if (
field?.value ||
(field?.required === false && field?.type !== 'checkbox')
) {
values[name.replace('shipping_address_', '')] = field.value
delete values[name]
}
Expand Down

0 comments on commit 4161a3c

Please sign in to comment.