# Mutations / Suppliers

# Suppliers

**Mutation**
## assignSupplier — Returns [Supplier](/documentation/Objects/Suppliers#Supplier)

**Scopes required:** edit_products

| Arguments | Type | Description |
| --- | --- | --- |
| id | [ID!](/documentation/Types/UUID#UUID) | The ID of the supplier |
| products | [[ID]](/documentation/Types/UUID#UUID) | A list of product IDs to assign to supplier |

**Example Mutation**

```graphql
mutation AssignSupplier($id: ID!) {
    assignSupplier(id: $id) {
        id,
        name,
        parent,
        deleted,
        mdbId
    }
}

# Example variables
{
    "id": "<ID>"
}
```

**Mutation**
## createOrFindSupplier — Returns [CreateOrFindSupplierResponse](/documentation/Objects/Suppliers#CreateOrFindSupplierResponse)

**Scopes required:** see_suppliers, create_suppliers

Create or Find a Supplier

| Arguments | Type | Description |
| --- | --- | --- |
| matchDetails | [SupplierInput!](/documentation/Inputs/Suppliers#SupplierInput) | The Supplier values to search for |

**Example Mutation**

```graphql
mutation CreateOrFindSupplier($matchDetails: SupplierInput!) {
    createOrFindSupplier(matchDetails: $matchDetails) {
        created
    }
}

# Example variables
{
    "matchDetails": []
}
```

**Mutation**
## createSupplier — Returns [Supplier](/documentation/Objects/Suppliers#Supplier)

**Scopes required:** create_suppliers

Create a new supplier

| Arguments | Type | Description |
| --- | --- | --- |
| mdbId | *Int* | The master database reference of the supplier |
| name | *String!* | The name of the supplier |
| status | [SupplierStatusEnum](/documentation/Enums/Suppliers#SupplierStatusEnum) | The status for the supplier, if inactive new orders cannot be created |
| contact | [ContactInput](/documentation/Inputs/Contact-Input#ContactInput) | The contact details for the supplier |
| businessNumber | *String* | The business number (ABN) of the supplier |
| accountNumber | *String* | The account number assigned to this vendor |
| orderNotes | *String* | Notes to display when ordering stock (presume this is visible by the supplier) |
| internalOrderNotes | *String* | Internal notes to display when ordering stock (not displayed outside Shopfront) |
| orderAutomaticEmail | *Boolean* | Whether to automatically email the supplier when ordering stock |
| defaultOrderTax | [DefaultOrderTaxEnum](/documentation/Enums/Suppliers#DefaultOrderTaxEnum) | The default tax type to use when receiving stock |
| emailFormat | [EmailFormatEnum](/documentation/Enums/Suppliers#EmailFormatEnum) | The email format to use when sending orders to the supplier |
| comments | *String* | Any internal comments to make about the supplier |
| feeAmount | *Float* | The default payment fee amount when receiving supplier invoices |
| distributeFees | [DistributeFeesEnum](/documentation/Enums/Suppliers#DistributeFeesEnum) | The method used to distribute fees when receiving invoices |
| distributeFreight | [DistributeFreightEnum](/documentation/Enums/Suppliers#DistributeFreightEnum) | The method used to distribute freight when receiving invoices |
| authentication | [[SupplierAuthenticationInput]](/documentation/Inputs/Supplier-Authentication-Input#SupplierAuthenticationInput) | The authentication details used for the supplier (internal only) |
| freightIncludedOnInvoices | *Boolean* | Whether freight is included on this supplier's invoices by default |
| freightTax | [ID](/documentation/Types/UUID#UUID) | The tax rate used when receiving freight on orders |
| feesTax | [ID](/documentation/Types/UUID#UUID) | The tax rate used when receiving fees on orders |
| allowOrderBelowMinimum | *Boolean* | Whether to allow orders to be sent with a value less than the minimumOrderValue |
| minimumOrderValue | *Float* | The minimum value an order can be to this supplier |
| maximumOrderValue | *Float* | The maximum value an order can be to this supplier |
| defaultDaysUntilDue | *Int* | The default number of days until a new order is due |
| freightFixedCostPerCase | *Float* | The cost of freight to apply to each cost through Shopfront's UI when editing an invoice |
| additionalContacts | [[SupplierAdditionalContactInput!]](/documentation/Inputs/Suppliers#SupplierAdditionalContactInput) | The additional contacts of the suppliers |

**Example Mutation**

```graphql
mutation CreateSupplier($name: String!) {
    createSupplier(name: $name) {
        id,
        name,
        parent,
        deleted,
        mdbId
    }
}

# Example variables
{
    "name": "<NAME>"
}
```

**Mutation**
## deleteSupplier — Returns [Supplier](/documentation/Objects/Suppliers#Supplier)

**Scopes required:** delete_suppliers

| Arguments | Type | Description |
| --- | --- | --- |
| id | [ID!](/documentation/Types/UUID#UUID) | The ID of the supplier to delete |

**Example Mutation**

```graphql
mutation DeleteSupplier($id: ID!) {
    deleteSupplier(id: $id) {
        id,
        name,
        parent,
        deleted,
        mdbId
    }
}

# Example variables
{
    "id": "<ID>"
}
```

**Mutation**
## mergeSuppliers — Returns [Supplier](/documentation/Objects/Suppliers#Supplier)

**Scopes required:** create_suppliers, delete_suppliers

Merge suppliers into a new supplier

| Arguments | Type | Description |
| --- | --- | --- |
| mdbId | *Int* | The master database reference of the supplier |
| name | *String!* | The name of the supplier |
| status | [SupplierStatusEnum](/documentation/Enums/Suppliers#SupplierStatusEnum) | The status for the supplier, if inactive new orders cannot be created |
| contact | [ContactInput](/documentation/Inputs/Contact-Input#ContactInput) | The contact details for the supplier |
| businessNumber | *String* | The business number (ABN) of the suppleir |
| accountNumber | *String* | The account number assigned to this vendor |
| orderNotes | *String* | Notes to display when ordering stock (presume this is visible by the supplier) |
| internalOrderNotes | *String* | Internal notes to display when ordering stock (not displayed outside Shopfront) |
| orderAutomaticEmail | *Boolean* | Whether to automatically email the supplier when ordering stock |
| defaultOrderTax | [DefaultOrderTaxEnum](/documentation/Enums/Suppliers#DefaultOrderTaxEnum) | The default tax type to use when receiving stock |
| emailFormat | [EmailFormatEnum](/documentation/Enums/Suppliers#EmailFormatEnum) | The email format to use when sending orders to the supplier |
| comments | *String* | Any internal comments to make about the supplier |
| feeAmount | *Float* | The default payment fee amount when receiving supplier invoices |
| distributeFees | [DistributeFeesEnum](/documentation/Enums/Suppliers#DistributeFeesEnum) | The method used to distribute fees when receiving invoices |
| distributeFreight | [DistributeFreightEnum](/documentation/Enums/Suppliers#DistributeFreightEnum) | The method used to distribute freight when receiving invoices |
| authentication | [[SupplierAuthenticationInput]](/documentation/Inputs/Supplier-Authentication-Input#SupplierAuthenticationInput) | The authentication details used for the supplier (internal only) |
| freightIncludedOnInvoices | *Boolean* | Whether freight is included on this supplier's invoices by default |
| freightTax | [ID](/documentation/Types/UUID#UUID) | The tax rate used when receiving freight on orders |
| feesTax | [ID](/documentation/Types/UUID#UUID) | The tax rate used when receiving fees on orders |
| allowOrderBelowMinimum | *Boolean* | Whether to allow orders to be sent with a value less than the minimumOrderValue |
| minimumOrderValue | *Float* | The minimum value an order can be to this supplier |
| maximumOrderValue | *Float* | The maximum value an order can be to this supplier |
| defaultDaysUntilDue | *Int* | The default number of days until a new order is due |
| freightFixedCostPerCase | *Float* | The cost of freight to apply to each cost through Shopfront's UI when editing an invoice |
| additionalContacts | [[SupplierAdditionalContactInput!]](/documentation/Inputs/Suppliers#SupplierAdditionalContactInput) | The additional contacts of the suppliers |
| merge | [[ID]](/documentation/Types/UUID#UUID) | The list of supplier IDs to merge into the new supplier |

**Example Mutation**

```graphql
mutation MergeSuppliers($name: String!) {
    mergeSuppliers(name: $name) {
        id,
        name,
        parent,
        deleted,
        mdbId
    }
}

# Example variables
{
    "name": "<NAME>"
}
```

**Mutation**
## updateSupplier — Returns [Supplier](/documentation/Objects/Suppliers#Supplier)

**Scopes required:** edit_suppliers

| Arguments | Type | Description |
| --- | --- | --- |
| id | [ID!](/documentation/Types/UUID#UUID) | The ID of the supplier |
| mdbId | *Int* | The master database reference of the supplier |
| name | *String!* | The name of the supplier |
| status | [SupplierStatusEnum](/documentation/Enums/Suppliers#SupplierStatusEnum) | The status for the supplier, if inactive new orders cannot be created |
| contact | [ContactInput](/documentation/Inputs/Contact-Input#ContactInput) | The contact details for the supplier |
| businessNumber | *String* | The business number (ABN) of the suppleir |
| accountNumber | *String* | The account number assigned to this vendor |
| orderNotes | *String* | Notes to display when ordering stock (presume this is visible by the supplier) |
| internalOrderNotes | *String* | Internal notes to display when ordering stock (not displayed outside Shopfront) |
| orderAutomaticEmail | *Boolean* | Whether to automatically email the supplier when ordering stock |
| defaultOrderTax | [DefaultOrderTaxEnum](/documentation/Enums/Suppliers#DefaultOrderTaxEnum) | The default tax type to use when receiving stock |
| emailFormat | [EmailFormatEnum](/documentation/Enums/Suppliers#EmailFormatEnum) | The email format to use when sending orders to the supplier |
| comments | *String* | Any internal comments to make about the supplier |
| feeAmount | *Float* | The default payment fee amount when receiving supplier invoices |
| distributeFees | [DistributeFeesEnum](/documentation/Enums/Suppliers#DistributeFeesEnum) | The method used to distribute fees when receiving invoices |
| distributeFreight | [DistributeFreightEnum](/documentation/Enums/Suppliers#DistributeFreightEnum) | The method used to distribute freight when receiving invoices |
| authentication | [[SupplierAuthenticationInput]](/documentation/Inputs/Supplier-Authentication-Input#SupplierAuthenticationInput) | The authentication details used for the supplier (internal only) |
| freightIncludedOnInvoices | *Boolean* | Whether freight is included on this supplier's invoices by default |
| freightTax | [ID](/documentation/Types/UUID#UUID) | The tax rate used when receiving freight on orders |
| feesTax | [ID](/documentation/Types/UUID#UUID) | The tax rate used when receiving fees on orders |
| allowOrderBelowMinimum | *Boolean* | Whether to allow orders to be sent with a value less than the minimumOrderValue |
| minimumOrderValue | *Float* | The minimum value an order can be to this supplier |
| maximumOrderValue | *Float* | The maximum value an order can be to this supplier |
| defaultDaysUntilDue | *Int* | The default number of days until a new order is due() |
| freightFixedCostPerCase | *Float* | The cost of freight to apply to each cost through Shopfront's UI when editing an invoice |
| additionalContacts | [[SupplierAdditionalContactInput!]](/documentation/Inputs/Suppliers#SupplierAdditionalContactInput) | The additional contacts of the suppliers |

**Example Mutation**

```graphql
mutation UpdateSupplier($id: ID!, $name: String!) {
    updateSupplier(id: $id, name: $name) {
        id,
        name,
        parent,
        deleted,
        mdbId
    }
}

# Example variables
{
    "id": "<ID>",
    "name": "<NAME>"
}
```