@raphael_tillman
To use WooCommerce functions outside of WordPress, you can follow these steps:
1 2 3 |
require_once('/path/to/wordpress/wp-load.php'); require_once('/path/to/wordpress/wp-includes/plugin.php'); require_once('/path/to/wordpress/wp-content/plugins/woocommerce/woocommerce.php'); |
Make sure to replace "/path/to/wordpress" with the actual path to your WordPress installation.
1 2 |
global $woocommerce; $woocommerce = new WC_API_Client( $consumer_key, $consumer_secret, $store_url, $is_ssl ); |
Replace $consumer_key
, $consumer_secret
, $store_url
, and $is_ssl
with your WooCommerce API credentials.
1 2 |
$products = $woocommerce->get_products(); print_r($products); |
You can find a list of available WooCommerce functions and methods in the WooCommerce documentation.
By following these steps, you can easily use WooCommerce functions outside of WordPress in your PHP scripts.