Skip to content

Instantly share code, notes, and snippets.

@melvinstanly
Created April 9, 2019 12:56
Show Gist options
  • Save melvinstanly/1c7f245a7e7009935f140db3b7473717 to your computer and use it in GitHub Desktop.
Save melvinstanly/1c7f245a7e7009935f140db3b7473717 to your computer and use it in GitHub Desktop.
<?php
if( is_wc_endpoint_url( 'order-received' ) ){
//To check if thank you page
}
if(is_checkout()){
// Check if in checkout page
}
is_page( 'cart' ) || is_cart() // -------> Cart page
is_product_category()
// Returns true when viewing a product category archive.
is_product_category( 'shirts' )
// When the product category page for the ‘shirts’ category is being displayed.
is_product_category( array( 'shirts', 'games' ) )
// When the product category page for the ‘shirts’ or ‘games’ category is being displayed.
is_product_tag()
// Returns true when viewing a product tag archive
is_product_tag( 'shirts' )
// When the product tag page for the ‘shirts’ tag is being displayed.
is_product_tag( array( 'shirts', 'games' ) )
// When the product tag page for the ‘shirts’ or ‘games’ tags is being displayed.
is_product()
// Returns true on a single product page. Wrapper for is_singular.
is_wc_endpoint_url()
// Returns true when viewing a WooCommerce endpoint
is_wc_endpoint_url( 'order-pay' )
// When the endpoint page for order pay is being displayed.
is_wc_endpoint_url( 'order-received' )
// When the endpoint page for order received is being displayed.
is_wc_endpoint_url( 'view-order' )
// When the endpoint page for view order is being displayed.
is_wc_endpoint_url( 'edit-account' )
// When the endpoint page for edit account is being displayed.
is_wc_endpoint_url( 'edit-address' )
// When the endpoint page for edit address is being displayed.
is_wc_endpoint_url( 'lost-password' )
// When the endpoint page for lost password is being displayed.
is_wc_endpoint_url( 'customer-logout' )
// When the endpoint page for customer logout is being displayed.
is_wc_endpoint_url( 'add-payment-method' )
// When the endpoint page for add payment method is being displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment