# 设置 #

设置 API 允许您查看所有可用的设置组。

## 设置组属性 ##

| 属性          | 类型   | 描述                                                                                                 |
|---------------|--------|------------------------------------------------------------------------------------------------------|
| `id`          | string | 可用于将设置关联在一起的唯一标识符。<i class="label label-info">只读</i>                            |
| `label`       | string | 在界面中使用的、人类可读的设置标签。<i class="label label-info">只读</i>                            |
| `description` | string | 在界面中使用的、人类可读的设置描述。<i class="label label-info">只读</i>                            |
| `parent_id`   | string | 父分组的 ID。<i class="label label-info">只读</i>                                                   |
| `sub_groups`  | string | 设置子组的 ID。<i class="label label-info">只读</i>                                                 |

## 列出所有设置组 ##

此 API 可帮助您查看所有设置组。

### HTTP 请求 ###

<div class="api-endpoint">
	<div class="endpoint-data">
		<i class="label label-get">GET</i>
		<h6>/wp-json/wc/v3/settings</h6>
	</div>
</div>

```shell
curl https://example.com/wp-json/wc/v3/settings \
	-u consumer_key:consumer_secret
```

```javascript
WooCommerce.get("settings")
  .then((response) => {
    console.log(response.data);
  })
  .catch((error) => {
    console.log(error.response.data);
  });
```

```php
<?php print_r($woocommerce->get('settings')); ?>
```

```python
print(wcapi.get("settings").json())
```

```ruby
woocommerce.get("settings").parsed_response
```

> JSON 响应示例：

```json
[
  {
    "id": "general",
    "label": "General",
    "description": "",
    "parent_id": "",
    "sub_groups": [],
    "_links": {
      "options": [
        {
          "href": "https://example.com/wp-json/wc/v3/settings/general"
        }
      ]
    }
  },
  {
    "id": "products",
    "label": "Products",
    "description": "",
    "parent_id": "",
    "sub_groups": [],
    "_links": {
      "options": [
        {
          "href": "https://example.com/wp-json/wc/v3/settings/products"
        }
      ]
    }
  },
  {
    "id": "tax",
    "label": "Tax",
    "description": "",
    "parent_id": "",
    "sub_groups": [],
    "_links": {
      "options": [
        {
          "href": "https://example.com/wp-json/wc/v3/settings/tax"
        }
      ]
    }
  },
  {
    "id": "shipping",
    "label": "Shipping",
    "description": "",
    "parent_id": "",
    "sub_groups": [],
    "_links": {
      "options": [
        {
          "href": "https://example.com/wp-json/wc/v3/settings/shipping"
        }
      ]
    }
  },
  {
    "id": "checkout",
    "label": "Checkout",
    "description": "",
    "parent_id": "",
    "sub_groups": [],
    "_links": {
      "options": [
        {
          "href": "https://example.com/wp-json/wc/v3/settings/checkout"
        }
      ]
    }
  },
  {
    "id": "account",
    "label": "Accounts",
    "description": "",
    "parent_id": "",
    "sub_groups": [],
    "_links": {
      "options": [
        {
          "href": "https://example.com/wp-json/wc/v3/settings/account"
        }
      ]
    }
  },
  {
    "id": "email",
    "label": "Emails",
    "description": "",
    "parent_id": "",
    "sub_groups": [
      "email_new_order",
      "email_cancelled_order",
      "email_failed_order",
      "email_customer_on_hold_order",
      "email_customer_processing_order",
      "email_customer_completed_order",
      "email_customer_refunded_order",
      "email_customer_invoice",
      "email_customer_note",
      "email_customer_reset_password",
      "email_customer_new_account"
    ],
    "_links": {
      "options": [
        {
          "href": "https://example.com/wp-json/wc/v3/settings/email"
        }
      ]
    }
  },
  {
    "id": "integration",
    "label": "Integration",
    "description": "",
    "parent_id": "",
    "sub_groups": [],
    "_links": {
      "options": [
        {
          "href": "https://example.com/wp-json/wc/v3/settings/integration"
        }
      ]
    }
  },
  {
    "id": "api",
    "label": "API",
    "description": "",
    "parent_id": "",
    "sub_groups": [],
    "_links": {
      "options": [
        {
          "href": "https://example.com/wp-json/wc/v3/settings/api"
        }
      ]
    }
  },
  {
    "id": "email_new_order",
    "label": "New order",
    "description": "New order emails are sent to chosen recipient(s) when a new order is received.",
    "parent_id": "email",
    "sub_groups": [],
    "_links": {
      "options": [
        {
          "href": "https://example.com/wp-json/wc/v3/settings/email_new_order"
        }
      ]
    }
  },
  {
    "id": "email_cancelled_order",
    "label": "Cancelled order",
    "description": "Cancelled order emails are sent to chosen recipient(s) when orders have been marked cancelled (if they were previously processing or on-hold).",
    "parent_id": "email",
    "sub_groups": [],
    "_links": {
      "options": [
        {
          "href": "https://example.com/wp-json/wc/v3/settings/email_cancelled_order"
        }
      ]
    }
  },
  {
    "id": "email_failed_order",
    "label": "Failed order",
    "description": "Failed order emails are sent to chosen recipient(s) when orders have been marked failed (if they were previously processing or on-hold).",
    "parent_id": "email",
    "sub_groups": [],
    "_links": {
      "options": [
        {
          "href": "https://example.com/wp-json/wc/v3/settings/email_failed_order"
        }
      ]
    }
  },
  {
    "id": "email_customer_on_hold_order",
    "label": "Order on-hold",
    "description": "This is an order notification sent to customers containing order details after an order is placed on-hold.",
    "parent_id": "email",
    "sub_groups": [],
    "_links": {
      "options": [
        {
          "href": "https://example.com/wp-json/wc/v3/settings/email_customer_on_hold_order"
        }
      ]
    }
  },
  {
    "id": "email_customer_processing_order",
    "label": "Processing order",
    "description": "This is an order notification sent to customers containing order details after payment.",
    "parent_id": "email",
    "sub_groups": [],
    "_links": {
      "options": [
        {
          "href": "https://example.com/wp-json/wc/v3/settings/email_customer_processing_order"
        }
      ]
    }
  },
  {
    "id": "email_customer_completed_order",
    "label": "Completed order",
    "description": "Order complete emails are sent to customers when their orders are marked completed and usually indicate that their orders have been shipped.",
    "parent_id": "email",
    "sub_groups": [],
    "_links": {
      "options": [
        {
          "href": "https://example.com/wp-json/wc/v3/settings/email_customer_completed_order"
        }
      ]
    }
  },
  {
    "id": "email_customer_refunded_order",
    "label": "Refunded order",
    "description": "Order refunded emails are sent to customers when their orders are marked refunded.",
    "parent_id": "email",
    "sub_groups": [],
    "_links": {
      "options": [
        {
          "href": "https://example.com/wp-json/wc/v3/settings/email_customer_refunded_order"
        }
      ]
    }
  },
  {
    "id": "email_customer_invoice",
    "label": "Customer invoice",
    "description": "Customer invoice emails can be sent to customers containing their order information and payment links.",
    "parent_id": "email",
    "sub_groups": [],
    "_links": {
      "options": [
        {
          "href": "https://example.com/wp-json/wc/v3/settings/email_customer_invoice"
        }
      ]
    }
  },
  {
    "id": "email_customer_note",
    "label": "Customer note",
    "description": "Customer note emails are sent when you add a note to an order.",
    "parent_id": "email",
    "sub_groups": [],
    "_links": {
      "options": [
        {
          "href": "https://example.com/wp-json/wc/v3/settings/email_customer_note"
        }
      ]
    }
  },
  {
    "id": "email_customer_reset_password",
    "label": "Reset password",
    "description": "Customer \"reset password\" emails are sent when customers reset their passwords.",
    "parent_id": "email",
    "sub_groups": [],
    "_links": {
      "options": [
        {
          "href": "https://example.com/wp-json/wc/v3/settings/email_customer_reset_password"
        }
      ]
    }
  },
  {
    "id": "email_customer_new_account",
    "label": "New account",
    "description": "Customer \"new account\" emails are sent to the customer when a customer signs up via checkout or account pages.",
    "parent_id": "email",
    "sub_groups": [],
    "_links": {
      "options": [
        {
          "href": "https://example.com/wp-json/wc/v3/settings/email_customer_new_account"
        }
      ]
    }
  }
]
```