Automattic\WooCommerce\StoreApi\Schemas\V1\Agentic

CheckoutSessionSchema::get_linksprotectedWC 1.0

Get links for the session.

Method of the class: CheckoutSessionSchema{}

No Hooks.

Returns

Array. Links array.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_links();

CheckoutSessionSchema::get_links() code WC 10.8.1

protected function get_links() {
	$links = [];

	// Terms of use.
	$terms_page_id = wc_terms_and_conditions_page_id();
	if ( $terms_page_id ) {
		$permalink = get_permalink( $terms_page_id );
		if ( $permalink ) {
			$links[] = [
				'type' => LinkType::TERMS_OF_USE,
				'url'  => $permalink,
			];
		}
	}

	// Privacy policy.
	$privacy_page_id = get_option( 'wp_page_for_privacy_policy' );
	if ( $privacy_page_id ) {
		$permalink = get_permalink( $privacy_page_id );
		if ( $permalink ) {
			$links[] = [
				'type' => LinkType::PRIVACY_POLICY,
				'url'  => $permalink,
			];
		}
	}

	return $links;
}