E
E
eps-game2020-06-12 15:55:56
PHP
eps-game, 2020-06-12 15:55:56

How to parse a WooCommerce endpoint?

Good day everyone!

The task is, how to correctly ask the endpoint from under the woocommerce_my_account hook (being on the WooCommerce account page)?

If parsing the mask with GET in the request is easy:
wordpress/my-account?view-order=1673

then how to parse this?:
wordpress/my-account/view-order/1673/

The function works on the first page and on the second, but in the second option, I can't get the order ID because the URL mask can be unpredictable. The variable $order is not declared in
is_wc_endpoint_url( 'view-order' )

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
eps-game, 2020-06-12
@eps-game

I will answer myself.

global $wp;
$wp->query_vars;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question