# Edit or delete a discount component

## Overview

[Video: Edit or delete a discount component](https://www.youtube.com/watch?v=mVy_MRPXtFs)

This flow describes how to change a discount component in the [billing settings](https://docs.ohc.network/concepts/billing/billing-settings.md) of a facility. It also describes how to delete a discount component that the facility no longer uses.

You can change or delete only the discount components of the facility. The discount components of the deployment, marked **Instance**, are read only.

## Pre-requisites

* You are a member of the facility in any role, or of its geographic organization or an organization above it.
* The facility has a discount component of its own, marked **Facility** in the list.
* The facility has saved a discount configuration. If it has not, [set the discount configuration](https://docs.ohc.network/flows/billing/billing-settings/set-discount-configuration.md) first.
* If you want to give the discount component a new discount code of the facility, [create the discount code](https://docs.ohc.network/flows/billing/billing-settings/create-discount-code.md) first.
* You have the permissions listed below.

## Permissions

| Permission | Access |
| - | - |
| Can Update on Facility | Lets you save the billing settings of the facility. It counts when you hold it through a role in the facility's root organization, which Care names Administration. A role in the facility's geographic organization, or in an organization above it, also counts. A role that you hold only in a department or team of the facility does not count. By default, the Facility Admin, Administrator and Staff roles hold it. Every member of the facility can open the page and use its buttons. Without this permission, Care refuses the save with a message that contains "You do not have permission to create Facilities". |
| Can Read Tag Config | Needed only if you add a condition on a tag. It lets the tag picker show the tags. Care looks for it in any organization of the facility. By default, the Facility Admin, Administrator, Staff, Doctor, Nurse, Volunteer and Pharmacist roles hold it. |

## Steps

### 1. Open the discount components

In the facility sidebar, under **Administration**, select **Settings**.

Care shows the settings sidebar of the facility.

In the **Billing** group, select **Billing**.

Under **Discount**, select **Discount Components**.

The page title reads **Discount Monetary Components**.

Find the row of the discount component. You can search by its name, its discount code, or the name of the discount code.

Only rows marked **Facility** have the pencil icon and the trash icon.

![The facility sidebar, with Settings outlined under Administration](/assets/images/edit-or-delete-discount-component-1-9fd35be0b8e26d50957e3b617117a6fc.webp)

![The discount components list, with the facility component Senior Citizen Discount outlined](/assets/images/edit-or-delete-discount-component-2-39562379e06c80b26c679d2ca7cf4534.webp)

### 2. Edit the discount component

Do this step only if you want to change the discount component.

Select the pencil icon on the row.

Care opens a form titled **Edit Discount Component**, with the current details filled in.

If the discount is a percentage, the form opens on **Factor**.

Change the fields that you want to update. The fields are the same as in [Create a discount component](https://docs.ohc.network/flows/billing/billing-settings/create-discount-component.md).

If you switch between **Amount** and **Factor**, Care clears the other value. Care keeps only one of the two.

Select **Save**.

Note: **Save** stays disabled until you change a field.

Care closes the form at once, before it saves the change.

If Care saves the change, it shows the message "Discount component updated!"

If Care refuses the save, your changes are lost. Open the form again. Make the changes again.

If Care shows an error message, use this table.

| If the message contains | What to do |
| - | - |
| Field required | The facility has not saved a discount configuration. [Set the discount configuration](https://docs.ohc.network/flows/billing/billing-settings/set-discount-configuration.md) first. Then change the discount component again. |
| You do not have permission to create Facilities | You do not hold the permission listed above in the right organization. Ask for a role that has it in the facility's root organization, Administration. |

Note: Charge item definitions that use **Use facility global value** find the discount component by its discount code. If you change the discount code, definitions that use the old code no longer get this discount component.

![The Edit Discount Component sheet, with the amount changed to 150](/assets/images/edit-or-delete-discount-component-3-cd98a40d39559d10cb58339784d26b28.webp)

### 3. Delete the discount component

Do this step only if the facility no longer uses the discount component.

Select the trash icon on the row.

Care opens the **Confirm Delete** dialog. The dialog asks "Are you sure you want to delete this discount component from this facility?"

Select **Confirm**.

To keep the discount component, select **Cancel**.

If Care deletes the discount component, it shows the message "Discount component deleted!"

Note: Care does not check whether charge item definitions use the discount component.

![The Confirm Delete dialog for the discount component, with the Cancel and Confirm buttons](/assets/images/edit-or-delete-discount-component-4-eae934b4e34dc01d9d4b6fa11c13b094.webp)

![The discount components list after the delete, without the Senior Citizen Discount](/assets/images/edit-or-delete-discount-component-5-136eeb0dc353f797f4773462bc7fb830.webp)

## Expected Outcome

* After an edit, the list shows the new details of the discount component.
* After a delete, the discount component is no longer in the list.
* Charge item definitions can use a discount with **Use facility global value**. Each new charge item from such a definition gets the facility's current discount component with the same discount code.
* If you delete the discount component or change its code, Care looks for another discount component with the old code.
* If the facility has none, new charge items get the copy of the discount that is stored in the definition.
* Charge items that already exist do not change.

## Related

Concepts:

* [Billing settings](https://docs.ohc.network/concepts/billing/billing-settings.md)
* [Charge Item Definition](https://docs.ohc.network/concepts/definitions/charge-item-definition.md)
* [Charge Item](https://docs.ohc.network/concepts/billing/charge-item.md)

Flows:

* [Create a discount component](https://docs.ohc.network/flows/billing/billing-settings/create-discount-component.md)
* [Create a discount code](https://docs.ohc.network/flows/billing/billing-settings/create-discount-code.md)
* [Edit or delete a discount code](https://docs.ohc.network/flows/billing/billing-settings/edit-or-delete-discount-code.md)
* [Create a charge item definition](https://docs.ohc.network/flows/definitions/charge-item-definition/create-charge-item-definition.md)
* [Edit a charge item](https://docs.ohc.network/flows/billing/charge-item/edit-charge-item.md)
