WooCommerce开发过程中经常用到的核心函数
文 / @UTHEME
WooCommerce开发中常用的核心函数
我是小本本,今天为大家介绍在WooCommerce开发过程中常用的核心函数。这些函数位于includes/wc-core-functions.php文件中,可以在主题或插件中使用。
wc_mail
通过这个函数使用WooCommerce邮件模板发送HTML邮件。
wc_mail($to,$subject,$message,$headers="Content-Type:text/htmlrn",$attachments="")
wc_get_page_id($pagename)
通过页面名称获取WooCommerce页面ID。
wc_get_page_id($page)
wc_price($price,$args )
格式化价格数字为正确的小数格式,并添加货币符号。
wc_price($price,$args=array())
$args数组有一个可选项ex_tax_label–如果设置为true,将会显示一个‘包含税费’的信息。
wc_clean($var)
从字符串($var)中截取和清理标签。
wc_clean($var)
wc_get_dimension($dim,$to_unit)
以WooCommerce尺寸单位获取尺寸(dim),并转换为需要的尺寸单位($to_unit)。
wc_get_dimension(10,'lbs')
wc_get_weight($weight,$to_unit)
以WooCommerce重量单位获取重量($weight),并转换为需要的重量单位($to_unit)。
wc_get_weight(10,'lbs')
以上是我们在WooCommerce开发中经常用到的一些核心函数。

相关文章
-
IDC/ISP办理许可证的基本条件(附:IDC和ISP许可证申请流程) 2023-06-07 08:00:01
-
利用tinymce.activeEditor获取到 WordPress可视化编辑器中的值(附:tinymce.activeEditor常见其他用法) 2023-06-06 08:00:02
-
WordPress是什么框架吗?WordPress是用什么写的? 2023-06-06 08:00:02
-
WordPress哪个版本稳定好用(附:如何查看当前WordPress版本) 2023-06-06 08:00:02
-
Automattic 发布 wp-now:由 WordPress Playground 提供支持的本地开发环境 2023-06-05 08:00:02
-
PHP预定义常量都有哪些(含常见PHP魔术常量) 2023-06-04 08:00:01
-
php的 require 和include 有什么区别 2023-06-04 08:00:01
-
UGPT插件:国内首个永久免费WordPress ChatGPT插件 2023-06-04 08:00:01
-
wordpress seo哪个插件好用 – WordPress SEO by Yoast 2023-06-03 08:00:02
-
WordPress古腾堡编辑器模块开发教程 2023-06-03 08:00:02