Ultimate guide to edit and delete address in magento mobile app

Magento is based on open source platform for e-commerce which provides smooth shopping cart system with control over the look and functionality of the store. It is growing in the e-commerce market day by day. More traders are using this platform for their e-store. It provides a various feature for an e-commerce store, you can check its features in our previous blog. With the increase in the e-commerce stores, mobile-commerce has also become popular these days. Mobile visits account for one-third of e-commerce sites traffic. To have an e-commerce mobile app for electronic commerce store is like putting a  retail outlet in the customer’s pocket. Magento provides SEO, items management, and other tools. It enforce traders to have the mobile app for superb shopping experience for customers.  In this blog, I am going to discuss some important features i.e edit delete address Magento in the mobile app using REST API.

Edit Delete address Magento:

Here we will discuss the edit delete address Magento in a mobile app using REST API. Here we take an example of two address.

{
 "customer": 
   {
     "email": "[email protected]",
     "firstname": "test",
     "lastname": "test",
     "websiteId": 0,
        "addresses": [
           {
              "id": 1,
              "firstname": "test",
              "lastname": "test",
              "company": "test technology",
              "street": ["Test Street 9", "Tiny House 9"],
              "city": "City Nine",
              "region_id": 12,
              "region": "California",
              "postcode": "91790",
              "country_id": "US",
              "telephone": "1234567890"
           }, 
           {
             "id": 2,
             "firstname": "test",
             "lastname": "test",
             "company": "test technology",
             "street": ["Test Street 10", "Tiny House 10"],
             "city": "City Ten",
             "region_id": 12,
             "region": "California",
             "postcode": "91790",
             "country_id": "US",
             "telephone": "1234567890"
            }]
   }
}

Edit address in Magento:

Below is the API to create a customer. Then put the parameters for the address:

 PUT http://Base URL/rest/V1/customers/me

Now we can edit the address by using the address id. If we send the address id with change data then only that address will be changed that we want to edit. If we don’t send the address id then the new address will be generated.


{ "customer":
    {
       "email":"[email protected]",
       "firstname":"test",
       "lastname":"test",
       "websiteId": 0,
       "addresses": [
            {
                "id": 1,
                "firstname": "testedit",
                "lastname": "testedit",
                "company": "test technology edit",
                "street": [
                "Test Street 9",
                "Tiny House 9"
                ],
                "city": "City Nine edit",
                "region_id": 12,
                "region": "California",
                "postcode": "91790000",
                "country_id": "US",
                "telephone": "123456789000"
            },
            {
                "firstname": "test",
                "lastname": "test",
                "company": "test technology",
                "street": [
                "Test Street 10",
                "Tiny House 10"
                ],
                "city": "City Ten",
                "region_id": 12,
                "region": "California",
                "postcode": "91790",
                "country_id": "US",
                "telephone": "1234567890"
            }
        ]
    }

In the example we send the address id with the parameters then id with 1 will be edited.

Delete address in Magento:

Below is the API to create a customer. Then put the parameters for the address:

PUT http://Base URL/rest/V1/customers/me

Now we can delete the address by not sending the address in the parameter. For example, we want to delete the address with id 1. Then we will not send the id 1 in the addresses. Then that address will not be generated and that address will not come in the address list.

 { "customer":
    {
       "email":"[email protected]",
       "firstname":"test",
       "lastname":"test",
       "websiteId": 0,
       "addresses": [
            {
                "id":2
                "firstname": "test",
                "lastname": "test",
                "company": "test technology",
                "street": [
                "Test Street 10",
                "Tiny House 10"
                ],
                "city": "City Ten",
                "region_id": 12,
                "region": "California",
                "postcode": "91790",
                "country_id": "US",
                "telephone": "1234567890"
            }
        ]
    }

By this address id with 1 will be deleted.

These are the ways to edit and delete the address in the Magento app using the Mgento API.

Conclusion

As the implementation of Magento framework is increasing day by day for the e-commerce stores, demand for mobile commerce is also increasing with the same speed and popularity. So developing an e-commerce mobile app is becoming common and for any e-commerce store edit and delete address are very common and powerful property. Keeping these all things in mind I wrote this article to help the new developer for Magento. I hope this will help you… :-). Below is our sample app based on Magento REST API, you can refer it as an example which has shown the use of edit deletes address Magento using REST APIs.

magento-logo
MagentoShop
Looking for a native Magento mobile app builder (iOS/Android) for your Magento based online marketplace? Try the 30-day free trial of our Magento mobile app, go mobile commerce in a few hours and increase your sales exponentially. No Setup Fee, Pay as you go pack at just $69/month.

References

  • Magento: Magento Documentation for Developers
  • Magento API: Magento API Documentation for Developers. Get the Edit Delete address Magento API.

Further reading:

Leave a Comment

Scroll to Top