Get WooCommerce Page ID
Get page ID:
<?php $myaccount_page_id = wc_get_page_id( 'myaccount' ); $shop_page_id = wc_get_page_id( 'shop' ); $cart_page_id = wc_get_page_id( 'cart' ); $checkout_page_id = wc_get_page_id( 'checkout' ); $terms_page_id = wc_get_page_id( 'terms' ); ?>
The return does not exist -1
.
Get WooCommerce Page URL
Get page URL (permalink):
<?php $myaccount_url = wc_get_page_permalink( 'myaccount' ); $shop_url = wc_get_page_permalink( 'shop' ); $cart_url = wc_get_page_permalink( 'cart' ); $checkout_url = wc_get_page_permalink( 'checkout' ); $terms_url = wc_get_page_permalink( 'terms' ); ?>
It does not exist, return the home URL.
----
After more than recorded for use.
scenes to be used:
According to different user logged in, add dynamic menu