Woocommerce Helper Body Clases
function nm_is_woocommerce_page()
{
// Alt. methhod:
/*if ( is_woocommerce() ) {
return true;
}
$page_id = get_the_ID();
$woocommerce_keys = array (
'woocommerce_shop_page_id',
'woocommerce_terms_page_id',
'woocommerce_cart_page_id',
'woocommerce_checkout_page_id',
'woocommerce_pay_page_id',
'woocommerce_thanks_page_id',
'woocommerce_myaccount_page_id',
'woocommerce_edit_address_page_id',
'woocommerce_view_order_page_id',
'woocommerce_change_password_page_id',
'woocommerce_logout_page_id',
'woocommerce_lost_password_page_id'
) ;
foreach( $woocommerce_keys as $woocommerce_page_id ) {
if ( $page_id == get_option( $woocommerce_page_id, 0 ) ) {
return true;
}
}*/
// Get the current body class
$body_classes = get_body_class();
foreach ($body_classes as $body_class) {
// Check if the class contains the word "woocommrce"
if (strpos($body_class, 'woocommerce') !== false) {
return true;
}
}
return false;
}