🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
## 搭建wordpress 1,先搭建好wordpress,基本设置好 2,开启Log 和 debug功能,准备好开发了。 ``` config.php 设置: define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false ); define( 'WPS_DEBUG', true ); php.ini 设置: ini_set("log_errors", 1); ini_set("error_log", "/tmp/php-error.log"); ``` 参考[A Complete Guide to WordPress Debugging (Enable WP\_DEBUG + Other Tools) (kinsta.com)](https://kinsta.com/blog/wordpress-debug/) ![](https://img.kancloud.cn/13/8c/138c01bd060e8216df2585ec3e9d3652_1621x601.png) ``` 查看log,debug的地方: 1,管理后台:/wp-admin/admin.php?page=wc-status 2,宝塔的服务器错误日志 3,/wp-content->debug.log ``` 3,ssl证书和https,必须的。 [阿里云ssl证书](https://help.aliyun.com/document_detail/98574.html?spm=5176.14113079.help.dexternal.3e473effm7uIWd#concept-wxz-3xn-yfb) 4,基本wordpress功能学习,最基础的知识推荐看《[阿树](https://www.ashuwp.com/courses)》,深入浅出了解,建议看[wordpress大学](https://www.wpdaxue.com/tutorials) 4.1, WooCommerce 基本类 [Classes in WooCommerce - WooCommerce](https://woocommerce.com/document/class-reference/) ``` WC_Product WC_Customer WC_Cart ``` 4.2, rest-api [WooCommerce REST API - WooCommerce](https://woocommerce.com/document/woocommerce-rest-api/) 5,程序员需要基本了解客户基本需求,看看《 [60分及格的独立站]( https://www.chuhaibiji.com/18782/) 》 6,安装在服务器的情况下可能的问题:[解决线上不能操作文件权限问题](https://blog.csdn.net/aliveqf/article/details/70178503) ***** ***** ## 安装woocommerce插件: 1,直接从后台插件市场安装woocommerce,或者上传插件文件到plugin 注意:可能出现Google Listings and Ads插件不能安装问题,先跳过它。 2,选择模板 storefront 安装 3,创建一个商品作为测试一下功能 4,导入商品数据方便测试,[参考](https://woocommerce.com/document/importing-woocommerce-sample-data/) ,路径在 wordpress\wp-content\plugins\woocommerce\sample-data 5,观察和熟悉各种商品类型,都是很重要 * **Simple** – covers the vast majority of any products you may sell. Simple products are shipped and have no options. For example, a book. * **Grouped** – a collection of related products that can be purchased individually and only consist of simple products. For example, a set of six drinking glasses. * **External** or **Affiliate** – one that you list and describe on your website but is sold elsewhere. * **Variable** – a product with variations, each of which may have a different SKU, price, stock option, etc. For example, a t-shirt available in different colors and/or sizes. ***** ***** ## 开发环境的注意: 1,关闭卡慢资源(Gravatar, google font 等),wordpress是国际化的开源软件,所以国内环境需要适应一下。参考:[wordpress页面访问太慢?教你3招优化性能 - 简书 (jianshu.com)](https://www.jianshu.com/p/336d9a964404) 2,运行起来看看有没有问题,支付方式可以选择银行转账,或者checkout测试,完成整个支付购买流程。 注意要配置好SMTP发邮件,不然会报错。 > - I noticed some other similar 504 errors on forums relating to mail, which I thought would make sense based on the login and ordering with emails firing. I disabled woocommerce email notifcations, the orders now complete and show client side. 3,SMTP: 推荐插件 https://wordpress.org/plugins/easy-wp-smtp/ ![](https://img.kancloud.cn/7f/3e/7f3e018fbc0504766d9cb16af14bd74a_1016x830.png) 邮件日志记录插件: [WP Mail Logging – WordPress plugin | WordPress.org](https://wordpress.org/plugins/wp-mail-logging/) ![](https://img.kancloud.cn/65/cb/65cb567b7d00197d95523094ac546e42_1287x756.png) 4,(选)性能监控插件,[query-monitor](https://wordpress.org/plugins/query-monitor/) 插件,[教程](https://kinsta.com/blog/query-monitor/) 5,(选) https://tideways.com/ 性能监控服务 6, New relic ,最著名的性能监控。