get_woocommerce_api_url()
Deprecated from version 9.0.0 The Legacy REST API has been removed from WooCommerce core.. It is no longer supported and can be removed in future releases. It is recommended to replace this function with the same one.
Get the URL to the WooCommerce Legacy REST API.
Note that as of WooCommerce 9.0 the WooCommerce Legacy REST API has been moved to a dedicated extension, and the implementation of its root endpoint in WooCommerce core is now just a stub that will always return an error. See the setup_legacy_api_stub method in includes/class-woocommerce.php and: https://developer.woocommerce.com/2023/10/03/the-legacy-rest-api-will-move-to-a-dedicated-extension-in-woocommerce-9-0/
No Hooks.
Return
String
. the URL.
Usage
get_woocommerce_api_url( $path );
- $path(string) (required)
- an endpoint to include in the URL.
Changelog
Since 2.1 | Introduced. |
Deprecated since 9.0.0 | The Legacy REST API has been removed from WooCommerce core. |
get_woocommerce_api_url() get woocommerce api url code WC 9.5.1
function get_woocommerce_api_url( $path ) { $url = get_home_url( null, 'wc-api/v3/', is_ssl() ? 'https' : 'http' ); if ( ! empty( $path ) && is_string( $path ) ) { $url .= ltrim( $path, '/' ); } return $url; }