Skip to content

Commit

Permalink
Add address 2 data as well.
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdharmesh committed Aug 21, 2024
1 parent 907573a commit 3220e61
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions assets/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,8 @@
$(errorSelector).html('');
const formData = $(e.target).serializeArray();
const formDataObject = {};
formData.map((obj) => {
const newObj = {};
formData.forEach((obj) => {
formDataObject[obj.name] = obj.value;
return newObj;
});

const postData = {
Expand All @@ -348,6 +346,11 @@
},
};

// Add address2 if available.
if (formDataObject.address2 !== '') {
postData.address.address2 = formDataObject.address2;
}

$.post(
params.ajax_url,
{
Expand Down

0 comments on commit 3220e61

Please sign in to comment.