Automattic\WooCommerce\Internal\OrderReviews
Endpoint::render_shortcode
Render the Review Order page body for the WC-managed page.
Called by the_content the page that hosts [woocommerce_review_order]. Returns an empty string when the request did not arrive through the tokenised rewrite, so a logged-in admin previewing the page directly sees nothing rather than a partial form.
Method of the class: Endpoint{}
No Hooks.
Returns
String.
Usage
$Endpoint = new Endpoint(); $Endpoint->render_shortcode(): string;
Endpoint::render_shortcode() Endpoint::render shortcode code WC 10.8.1
public function render_shortcode(): string {
global $wp;
if ( ! isset( $wp->query_vars[ self::QUERY_VAR ] ) ) {
return '';
}
$order_id = absint( $wp->query_vars[ self::QUERY_VAR ] );
$order = $order_id ? wc_get_order( $order_id ) : false;
if ( ! $order instanceof WC_Order ) {
// gate_request() will already have 404'd; this is defensive.
return '';
}
ob_start();
wc_get_template( 'order/customer-review-order.php', array( 'order' => $order ) );
return (string) ob_get_clean();
}