> ## Documentation Index
> Fetch the complete documentation index at: https://dkkangoyazlmteknolojiticareta.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Deactivate Food Item

> Make a menu item unavailable for ordering

## Overview

Deactivates a specific menu item, making it unavailable for customers to order (e.g., out of stock, discontinued).

## Path Parameters

<ParamField path="food_id" type="integer" required>
  Food/product ID from the menu
</ParamField>

## Headers

<ParamField header="Access-Token" type="string" required>
  Your API access token
</ParamField>

## Response

<ResponseField name="status" type="boolean">
  `true` if successful
</ResponseField>

<ResponseField name="data" type="string">
  `"OK"` on success
</ResponseField>

## Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT https://www.xn--dkkango-n2a.com/api/integrations/foods/status-passive/1 \
    -H 'Access-Token: your-access-token'
  ```

  ```javascript JavaScript theme={null}
  const foodId = 1; // Beef Burrito

  const response = await fetch(
    `https://www.xn--dkkango-n2a.com/api/integrations/foods/status-passive/${foodId}`,
    {
      method: 'PUT',
      headers: {
        'Access-Token': 'your-access-token'
      }
    }
  );

  const data = await response.json();
  // Food item is now unavailable
  ```

  ```python Python theme={null}
  import requests

  food_id = 1  # Beef Burrito

  response = requests.put(
      f'https://www.xn--dkkango-n2a.com/api/integrations/foods/status-passive/{food_id}',
      headers={'Access-Token': 'your-access-token'}
  )

  data = response.json()
  # Food item is now unavailable
  ```

  ```php PHP theme={null}
  <?php
  $foodId = 1; // Beef Burrito
  $url = "https://www.xn--dkkango-n2a.com/api/integrations/foods/status-passive/{$foodId}";

  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_HTTPHEADER, array(
      'Access-Token: your-access-token'
  ));
  $response = curl_exec($ch);
  curl_close($ch);
  // Food item is now unavailable
  ?>
  ```
</CodeGroup>

## Success Response (200)

```json theme={null}
{
  "status": true,
  "data": "OK"
}
```

## Error Responses

<ResponseExample>
  ```json Authentication Error (401) theme={null}
  {
    "status": false,
    "error": "yetkisiz erişim"
  }
  ```

  ```json Invalid ID (403) theme={null}
  {
    "status": false,
    "error": "URL hatalı"
  }
  ```

  ```json Not Found (404) theme={null}
  {
    "status": false,
    "error": "ürün bulunamadı"
  }
  ```
</ResponseExample>

## Use Cases

<AccordionGroup>
  <Accordion title="Out of Stock">
    Deactivate item when ingredients run out.

    ```javascript theme={null}
    async function markOutOfStock(foodId, itemName) {
      await deactivateFood(foodId);
      
      notifyStaff(`⚠️ ${itemName} is now out of stock`);
      logInventoryChange(foodId, 'out_of_stock');
      
      // Optional: Notify manager
      if (await shouldNotifyManager(foodId)) {
        sendManagerAlert(`${itemName} out of stock - reorder needed`);
      }
    }
    ```
  </Accordion>

  <Accordion title="Quality Issues">
    Temporarily disable items with quality concerns.

    ```javascript theme={null}
    async function suspendItem(foodId, reason) {
      await deactivateFood(foodId);
      
      await logIssue({
        foodId,
        type: 'quality_issue',
        reason,
        timestamp: new Date(),
        suspendedBy: currentUser.id
      });
      
      notifyKitchenManager(
        `Item ${foodId} suspended: ${reason}`
      );
    }
    ```
  </Accordion>

  <Accordion title="End of Day Cleanup">
    Deactivate items that won't be available tomorrow.

    ```javascript theme={null}
    async function endOfDayCleanup() {
      const dailySpecials = await getDailySpecials();
      
      for (const special of dailySpecials) {
        await deactivateFood(special.id);
        console.log(`Deactivated daily special: ${special.name}`);
      }
    }
    ```
  </Accordion>

  <Accordion title="Time-Based Availability">
    Deactivate items outside their serving hours.

    ```javascript theme={null}
    // Deactivate breakfast at 11 AM
    scheduleDaily('11:00', async () => {
      const breakfastItems = [5, 6, 7, 8];
      
      for (const id of breakfastItems) {
        await deactivateFood(id);
      }
      
      console.log('Breakfast menu deactivated');
    });
    ```
  </Accordion>

  <Accordion title="Automatic Stock Management">
    Integrate with inventory system.

    ```javascript theme={null}
    async function checkInventory() {
      const menu = await getMenu();
      
      for (const item of menu) {
        const stock = await getStockLevel(item.food_id);
        
        if (stock <= 0 && item.status === 'ACTIVE') {
          await deactivateFood(item.food_id);
          notifyStaff(`Auto-deactivated: ${item.name} (no stock)`);
        }
      }
    }

    // Check every 10 minutes
    setInterval(checkInventory, 600000);
    ```
  </Accordion>
</AccordionGroup>

## What Happens

<Steps>
  <Step title="Status Updated">
    Item's `status` changes to `"INACTIVE"` in the database
  </Step>

  <Step title="Hidden from Customers">
    Item becomes unavailable in customer apps (hidden or shown as unavailable)
  </Step>

  <Step title="Orders Blocked">
    Customers cannot add this item to their cart or order it
  </Step>

  <Step title="Existing Orders Unaffected">
    Orders already placed with this item are not affected
  </Step>
</Steps>

<Warning>
  **Deactivating an item does NOT:**

  * Cancel existing orders containing this item
  * Prevent kitchen from preparing orders already in progress
  * Remove the item from your menu permanently

  It only prevents **new** orders from being placed.
</Warning>

## Best Practices

<Tabs>
  <Tab title="Notify Staff">
    ```javascript theme={null}
    async function deactivateWithNotification(foodId, itemName, reason) {
      await deactivateFood(foodId);
      
      // Notify all staff
      await broadcastNotification({
        type: 'item_unavailable',
        item: itemName,
        reason: reason,
        timestamp: new Date()
      });
      
      // Update POS display
      updateItemStatus(foodId, 'unavailable');
    }
    ```
  </Tab>

  <Tab title="Track Reasons">
    ```javascript theme={null}
    const DEACTIVATION_REASONS = {
      OUT_OF_STOCK: 'out_of_stock',
      QUALITY: 'quality_issue',
      EQUIPMENT: 'equipment_failure',
      SCHEDULED: 'scheduled_unavailable',
      DISCONTINUED: 'discontinued'
    };

    async function deactivateWithReason(foodId, reason) {
      await deactivateFood(foodId);
      
      await database.logDeactivation({
        foodId,
        reason,
        timestamp: new Date(),
        user: currentUser
      });
    }
    ```
  </Tab>

  <Tab title="Batch Deactivation">
    ```javascript theme={null}
    async function deactivateMultiple(foodIds, reason) {
      const results = [];
      
      for (const id of foodIds) {
        try {
          await deactivateFood(id);
          results.push({ id, status: 'success' });
        } catch (error) {
          results.push({ id, status: 'failed', error });
        }
      }
      
      console.log(`Deactivated ${results.filter(r => r.status === 'success').length}/${foodIds.length} items`);
      return results;
    }
    ```
  </Tab>

  <Tab title="Reactivation Reminder">
    ```javascript theme={null}
    async function deactivateWithReminder(foodId, reactivateAt) {
      await deactivateFood(foodId);
      
      // Schedule reminder
      scheduleReminder(reactivateAt, {
        type: 'reactivate_item',
        foodId,
        message: `Consider reactivating item ${foodId}`
      });
    }
    ```
  </Tab>
</Tabs>

## Integration Example

```javascript theme={null}
class MenuManager {
  async handleOutOfStock(foodId, itemName) {
    // 1. Deactivate in API
    await this.deactivateFood(foodId);
    
    // 2. Update local database
    await this.updateLocalStatus(foodId, 'inactive');
    
    // 3. Notify stakeholders
    await this.notifyStaff(itemName, 'out_of_stock');
    await this.notifyManager(itemName, 'needs_reorder');
    
    // 4. Log for analytics
    await this.logEvent({
      type: 'item_deactivated',
      foodId,
      itemName,
      reason: 'out_of_stock',
      timestamp: new Date()
    });
    
    // 5. Update UI
    this.updatePOSDisplay(foodId, 'unavailable');
  }
}
```

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Activate Food" icon="check" href="/api-reference/foods/status-active">
    Make item available again
  </Card>

  <Card title="Get Menu" icon="list" href="/api-reference/foods/get-foods">
    View all menu items and their status
  </Card>
</CardGroup>

<Tip>
  Integrate this endpoint with your inventory management system for real-time availability updates!
</Tip>
