[TOC]
# WooCommerce常用的API和帮助函数
### 1\. API
#### 1.1. WC\_Product
* `get_id()`:获取产品ID。
* `get_name()`:获取产品名称。
* `get_price()`:获取产品价格。
* `get_sale_price()`:获取产品折扣价。
* `get_regular_price()`:获取产品常规价。
* `get_stock_quantity()`:获取产品库存数量。
* `is_in_stock()`:检查产品是否有库存。
* `get_categories()`:获取产品分类。
* `get_tags()`:获取产品标签。
* `get_rating_count()`:获取产品评分次数。
* `get_average_rating()`:获取产品平均评分。
#### 1.2. WC\_Order
* `get_id()`:获取订单ID。
* `get_status()`:获取订单状态。
* `get_total()`:获取订单总金额。
* `get_billing_first_name()`:获取订单收件人姓名。
* `get_billing_last_name()`:获取订单收件人姓氏。
* `get_billing_email()`:获取订单收件人邮箱。
* `get_billing_phone()`:获取订单收件人电话。
* `get_shipping_first_name()`:获取订单收货人姓名。
* `get_shipping_last_name()`:获取订单收货人姓氏。
* `get_shipping_address_1()`:获取订单收货地址1。
* `get_shipping_address_2()`:获取订单收货地址2。
* `get_shipping_city()`:获取订单收货城市。
* `get_shipping_state()`:获取订单收货州/省份。
* `get_shipping_postcode()`:获取订单收货邮政编码。
#### 1.3. WC\_Cart
* `get_cart_contents()`:获取购物车中的产品。
* `get_cart_total()`:获取购物车中产品的总价。
* `add_to_cart()`:向购物车中添加产品。
* `remove_cart_item()`:从购物车中删除产品。
* `empty_cart()`:清空购物车。
#### 1.4. WC\_Customer
* `get_id()`:获取客户ID。
* `get_billing_first_name()`:获取客户账单收件人姓名。
* `get_billing_last_name()`:获取客户账单收件人姓氏。
* `get_billing_email()`:获取客户邮箱。
* `get_billing_phone()`:获取客户电话。
* `get_shipping_first_name()`:获取客户收货人姓名。
* `get_shipping_last_name()`:获取客户收货人姓氏。
* `get_shipping_address_1()`:获取客户收货地址1。
\-`get_shipping_address_2()`:获取客户收货地址2。
* `get_shipping_city()`:获取客户收货城市。
* `get_shipping_state()`:获取客户收货州/省份。
* `get_shipping_postcode()`:获取客户收货邮政编码。
### 2\. 帮助函数
#### 2.1. wc\_get\_product()
`wc_get_product($product_id)`:根据产品ID获取产品对象。
#### 2.2. wc\_get\_order()
`wc_get_order($order_id)`:根据订单ID获取订单对象。
#### 2.3. wc\_get\_order\_item\_meta()
`wc_get_order_item_meta($order_item_id, $meta_key, $single = true)`:获取订单项元数据。
#### 2.4. wc\_get\_customer()
`wc_get_customer($customer_id)`:根据客户ID获取客户对象。
#### 2.5. wc\_price()
`wc_price($price, $args = array())`:格式化价格。
#### 2.6. wc\_get\_template()
`wc_get_template($template_name, $args = array(), $template_path = '', $default_path = '')`:获取WooCommerce模板文件。
- 系统设计
- 需求分析
- 概要设计
- 详细设计
- 逻辑模型设计
- 物理模型设计
- 产品设计
- 数据驱动产品设计
- 首页
- 逻辑理解
- 微服务架构的关系数据库优化
- Java基础架构
- 编程范式
- 面向对象编程【模拟现实】
- 泛型编程【参数化】
- 函数式编程
- 响应式编程【异步流】
- 并发编程【多线程】
- 面向切面编程【代码复用解耦】
- 声明式编程【注解和配置】
- 函数响应式编程
- 语法基础
- 包、接口、类、对象和切面案例代码
- Springboot按以下步骤面向切面设计程序
- 关键词
- 内部类、匿名类
- 数组、字符串、I/O
- 常用API
- 并发包
- XML
- Maven 包管理
- Pom.xml
- 技术框架
- SpringBoot
- 项目文件目录
- Vue
- Vue项目文件目录
- 远程组件
- 敏捷开发前端应用
- Pinia Store
- Vite
- Composition API
- uniapp
- 本地方法JNI
- 脚本机制
- 编译器API
- 注释
- 源码级注释
- Javadoc
- 安全
- Swing和图形化编程
- 国际化
- 精实或精益
- 精实软件数据库设计
- 精实的原理与方法
- 项目
- 零售软件
- 扩展
- 1001_docker 示例
- 1002_Docker 常用命令
- 1003_微服务
- 1004_微服务数据模型范式
- 1005_数据模型
- 1006_springCloud
- AI 流程图生成
- Wordpress_6
- Woocommerce_7
- WooCommerce常用的API和帮助函数
- WooCommerce的钩子和过滤器
- REST API
- 数据库API
- 模板系统
- 数据模型
- 1.Woo主题开发流程
- Filter
- Hook
- 可视编辑区域的函数工具
- 渲染字段函数
- 类库和框架
- TDD 通过测试来驱动开发
- 编程范式对WordPress开发
- WordPress和WooCommerce的核心代码类库组成
- 数据库修改
- 1.WP主题开发流程与时间规划
- moho
- Note 1
- 基础命令