WC_Order::get_cancel_endpoint PHP Method

get_cancel_endpoint() public method

Helper method to return the cancel endpoint.
public get_cancel_endpoint ( ) : string
return string the cancel endpoint; either the cart page or the home page.
    public function get_cancel_endpoint()
    {
        $cancel_endpoint = wc_get_page_permalink('cart');
        if (!$cancel_endpoint) {
            $cancel_endpoint = home_url();
        }
        if (false === strpos($cancel_endpoint, '?')) {
            $cancel_endpoint = trailingslashit($cancel_endpoint);
        }
        return $cancel_endpoint;
    }

Usage Example

Beispiel #1
0
 /**
  * Test: get_cancel_endpoint
  */
 function test_get_cancel_endpoint()
 {
     $object = new WC_Order();
     $this->assertEquals('http://example.org/', $object->get_cancel_endpoint());
 }
WC_Order