Automattic\WooCommerce\Blocks\Domain\Services
CheckoutLink::add_checkout_link_endpoint
Add the checkout link endpoint.
Method of the class: CheckoutLink{}
No Hooks.
Returns
null. Nothing (null).
Usage
$CheckoutLink = new CheckoutLink(); $CheckoutLink->add_checkout_link_endpoint();
CheckoutLink::add_checkout_link_endpoint() CheckoutLink::add checkout link endpoint code WC 10.8.1
public function add_checkout_link_endpoint() {
// get registered rewrite rules.
$rules = get_option( 'rewrite_rules', array() );
$regex = '^checkout-link$';
add_rewrite_rule( $regex, 'index.php?checkout-link=true', 'top' );
// maybe flush rewrite rules if it was not previously in the option.
if ( ! isset( $rules[ $regex ] ) ) {
flush_rewrite_rules();
}
}