Automattic\WooCommerce\Internal\OrderReviews

Endpoint::render_shortcodepublicWC 1.0

Render the Review Order page body for the WC-managed page.

Called by the_content the page that hosts [woocommerce_review_order]. Confirms the current page and order key before rendering.

Method of the class: Endpoint{}

No Hooks.

Returns

String.

Usage

$Endpoint = new Endpoint();
$Endpoint->render_shortcode(): string;

Endpoint::render_shortcode() code WC 11.0.1

public function render_shortcode(): string {
	global $wp;

	$page_id = (int) wc_get_page_id( self::PAGE_KEY );
	if ( $page_id <= 0 || ! is_page( $page_id ) ) {
		return '';
	}

	if ( ! isset( $wp->query_vars[ self::QUERY_VAR ] ) ) {
		return '';
	}

	$order_id  = absint( $wp->query_vars[ self::QUERY_VAR ] );
	$order_key = $this->read_order_key();
	$order     = $order_id ? wc_get_order( $order_id ) : false;

	if ( ! $this->is_authorised( $order, $order_key ) ) {
		return '';
	}

	ob_start();
	wc_get_template( 'order/customer-review-order.php', array( 'order' => $order ) );
	return (string) ob_get_clean();
}