Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Bradley-D/7287723 to your computer and use it in GitHub Desktop.
Save Bradley-D/7287723 to your computer and use it in GitHub Desktop.
// Get The Page ID You Need
get_option( 'woocommerce_shop_page_id' );
get_option( 'woocommerce_cart_page_id' );
get_option( 'woocommerce_checkout_page_id' );
get_option( 'woocommerce_pay_page_id' );
get_option( 'woocommerce_thanks_page_id' );
get_option( 'woocommerce_myaccount_page_id' );
get_option( 'woocommerce_edit_address_page_id' );
get_option( 'woocommerce_view_order_page_id' );
get_option( 'woocommerce_terms_page_id' );
// An Example
function get_shop_featured_image() {
if( is_shop() ) {
$shop = get_option( 'woocommerce_shop_page_id' );
if( has_post_thumbnail( $shop ) ) {
echo get_the_post_thumbnail( $shop );
}
}
}
// In You Templage File Place The Following
// Line To Call The WooCommerce Shop Featured Image
// Now You're Cooking With Gas - BOOM!!
<?php get_shop_featured_image(); ?>
@Amschabort
Copy link

Hi everyone,

I know this is long ago. But Im not sure where exactly to post the php code to get the WooC shop page id showing. Im not sure what Alexkwatson means but '..in a template where you are trying to use these page IDs'.

Can anyone help?

@sniperkill
Copy link

I am trying to get product ID, How to get product ID and check for conditions ?

@cyphix333
Copy link

Thank you so much!

@Tiex84
Copy link

Tiex84 commented Apr 11, 2019

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment