wc_get_checkout_url

Gets the url to the checkout page.

Description

(string) wc_get_checkout_url(); 

Returns (string)

Url to checkout page


Usage

  1. if ( !function_exists( 'wc_get_checkout_url' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-core-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wc_get_checkout_url(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/wc-core-functions.php  
  1. function wc_get_checkout_url() { 
  2. $checkout_url = wc_get_page_permalink( 'checkout' ); 
  3. if ( $checkout_url ) { 
  4. // Force SSL if needed 
  5. if ( is_ssl() || 'yes' === get_option( 'woocommerce_force_ssl_checkout' ) ) { 
  6. $checkout_url = str_replace( 'http:', 'https:', $checkout_url ); 
  7.  
  8. return apply_filters( 'woocommerce_get_checkout_url', $checkout_url );