[Plugin: Woocommerce] if is_shop or is_cart not working
-
I am trying to modify the head and foot of my woocommerce pages. I have an if statement that is supposed to target the shop and cart of woocommerce but it isn’t. If I modify the php after the is statement nothing changes. But if I modify the php in the else statement is works:
This doesn’t work:
<?php if (function_exists('woocommerce')): ?> <?php if (is_cart() || is_shop()): ?> <?php get_template_part('inc/CHANGE'); ?> <?php endif ?> <?php else: ?> <?php get_template_part('inc/page-header'); ?> <?php endif ?>
This does work:
<?php if (function_exists('woocommerce')): ?> <?php if (is_cart() || is_shop()): ?> <?php get_template_part('inc/page-header'); ?> <?php endif ?> <?php else: ?> <?php get_template_part('inc/CHANGE'); ?> <?php endif ?>
I think the function woocommerce might not be properly defined, because this also works:
<?php if (is_cart() || is_shop()): ?> <?php get_template_part('inc/header-shop'); ?> <?php else: ?> <?php get_template_part('inc/page-header'); ?> <?php endif ?>
- The topic ‘[Plugin: Woocommerce] if is_shop or is_cart not working’ is closed to new replies.