Removing

Simple answer to remove the application from the sales channel

When the application is successfully set up, a cross will appear next to the application, which can be used to delete the application or delete its settings. In this step, if you use a callback or ui element or snippets, you need to delete them via the Retailys API. You also need to delete the settings from the application database. All these removals are solved in the function that we specified in the application initialization as a route for removing the application, ie callback-remove.

For example, a static snippet can be deleted using this endpoint.

Endpoint /System/Layouts/Eshop/Layout/StaticSnippets/{id} on the API you can easily try.

On this route, we will receive a token parameter that will contain our token associated with the instance, which we have stored in the database of our application. Subsequently, according to him, we look for config and if any exists, we can delete it.

For successful deletion, it is necessary to return the JSON format, which will contain the status parameter and it will have the value removed, so that the application is considered removed from our instance.

A simple example where at the end of the function, where we take care of removing the application settings from the database, or elements via the API, it has to be returned a simple JSON.

return $this->json(
            [
                'status' => 'removed',
            ]
        );

Last updated