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 if
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 ?>