Support » Plugin: WooCommerce » is_woocommerce, is_cart & is_checkout conditional tags broken

  • Hello,

    I’m trying to use the WooCommerce Conditional Tags:

    I’m attempting to implement conditional Google AdWords Conversion code, my is_front_page and is_page conditions are working fine, but is_cart/is_checkout doesn’t include the code:

    	$google_conversion_id = 986952114;
    	if (is_front_page()) {
    		$google_conversion_label = "mB_CCM7akggQsuPO1gM";
    	} elseif (is_page(9335)) {
    		$google_conversion_label = "-AbhCObXkggQsuPO1gM";
    	} elseif (is_cart()) {
    		$google_conversion_label = "nT4bCO7WkggQsuPO1gM";
    	} elseif (is_checkout()) {
    		$google_conversion_label = "ZLSeCPbVkggQsuPO1gM";
    	if ($google_conversion_label && $google_conversion_label != ""):
    <!-- Google Code for Conversion Page -->
    <script type="text/javascript">
    	/* <![CDATA[ */
    		var google_conversion_id = <?php echo $google_conversion_id;?>;
    		var google_conversion_language = "en";
    		var google_conversion_format = "3";
    		var google_conversion_color = "ffffff";
    		var google_conversion_label = "<?php echo $google_conversion_label;?>";
    		var google_remarketing_only = false;
    	/* ]]> */
    <script type="text/javascript" src="//"></script>
    	<div style="display:inline;">
    		<img height="1" width="1" style="border-style:none;" alt="" src="//<?php echo $google_conversion_id;?>/?label=<?php echo $google_conversion_label;?>&guid=ON&script=0"/>
    <?php endif; ?>

    This should include the Google Code for Conversion Page onto my cart and checkout pages through the is_cart and is_checkout conditionals:
    *I’ve tried even with them populated with product or subscription through our packages page:

    Also tried the following woo & wp conditionals with no luck;
    is_page(‘cart’) / is_page(‘checkout’)
    is_page(wc_get_page_id( ‘cart’ ))

    I’ve had no luck with any, not only are the woo conditionals not working, but the is_page doesn’t seem to recognize the page by it’s slug or it’s ID.

    Any ideas appreciated,

  • The topic ‘is_woocommerce, is_cart & is_checkout conditional tags broken’ is closed to new replies.