How to use woocommerce functions outside of wordpr

2019-08-18 03:22发布

问题:

I want to use woocommerce functions outside of wordpress. I have included the code below to use wordpress functions outside of wordpress:

 <?php
 require_once(dirname(__FILE__) . '/../../../wp-load.php');
require(dirname(__FILE__) . '/../../../wp-blog-header.php');
?

What other code do i have to include so woocommerce functions are accessible?

回答1:

Simply including the wp-load.php in the file you want to use the WooCommerce/WordPress functionality is enough (as long as the website is properly set up).