简体   繁体   中英

How to get “Terms & Conditions” Page ID in WooCommerce?

I'd like to know how to get the page which set as "Terms & Conditions Page" on "Appearance > Customize > WooCommerce > Checkout" on WordPress admin.

I could get privacy policy page with "is_privacy_policy()", but don't know how to get "Terms & Conditions Page".

I want to do this to make a plugin for WooCommerce not just for me but any person, so I can not know its page slug.

Thank you.

First terms and conditions WordPress page need to be defined in WooCommerce Settings > Advanced > Terms and conditions field…

Then you can get the "terms and conditions" page ID (and page) using:

$page_id = wc_terms_and_conditions_page_id();
$page    = $page_id ? get_post( $page_id ) : false;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM