-
-
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(); ?> |
Thanks! 1+ 😄
Hey guys...could you please tell me how to implement this?
I have one shop in English called 'shop' and one shop in Romanian called 'magazin'
I put the code in my functions.php file and the website goes down.
I really need your help please!? :(
Thanks!
thegap81 - this code doesn't go in functions.php. It might be used in a template where you are trying to use these page IDs
Cool. Thanks. I was trying to get rid of a button in the shop that said Go to Store, and I was trying to use if ( ! is_page ( ID ) ... but it didin't work. after looking at this I use if ( ! is_shop() ) ... bang! disappeared!
tried :
function new_nav_menu_items($items, $args) {
echo "args: <pre>"; print_r(get_option( 'woocommerce_shop_page_id' )); echo "</pre>";
return $items;
}
got : "args : 4"
i also see 4 in the link to modify the shop page. however this :
.page-id-4 h1.page-title {
}
does nothing. while other page ids (in the four digit format) and not putting the id works.
I think I'm being returned the wrong ID.
EDIT: as it turns out, for shop you have to use
.archive.post-type-archive-product.woocommerce{
Thanks !!! I've been looking for this for so long ^^
Thanks :)
Thank you man
hola, como están?, estuve leyendo detenidamente sus comentarios pero no me resulta, el link View cart sigue tirandome solo un idioma, y esta parte del codigo no la entendi
tried :
function new_nav_menu_items($items, $args) {
echo "args:
"; print_r(get_option( 'woocommerce_shop_page_id' )); echo "";
return $items;
}
got : "args : 4"
i also see 4 in the link to modify the shop page. however this :
.page-id-4 h1.page-title {
}
does nothing. while other page ids (in the four digit format) and not putting the id works.
I think I'm being returned the wrong ID.
EDIT: as it turns out, for shop you have to use
.archive.post-type-archive-product.woocommerce{
alguien que me pueda orientar?
👍
This is very helpful, thank you for sharing!
Alternatively the recent wc_get_page_id(...)
method can also be used.
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?
I am trying to get product ID, How to get product ID and check for conditions ?
Thank you so much!
Thanks!
Awesome! Thanks. Very useful.