Conditional Tags for Woocommerce
We already shared about normal WordPress conditional tags Hide Elements on Specific WordPress Pages Using If , else Condition. Now we are sharing conditional tags for Woocommerce.
For pages which use Woocommerce templates (cart and checkout pages are not included)
<?php if(is_woocommerce() ) { ?> <div class="joint_btn">Only for pages which use woocommerce templates (cart and checkout pages are not included)</div> <?php } ?>
Only for woocommerce shop page
<?php if(is_shop() ) { ?> <div class="joint_btn">Only for woocommerce shop page</div> <?php } ?>
Only for woocommerce product category archive page
<?php if(is_product_category() ) { ?> <div class="joint_btn">Only for woocommerce product category archive page </div> <?php } ?>
Only for product category page with category name ‘mobile’
<?php if(is_product_category( 'mobile' ) ) { ?> <div class="joint_btn">Only for product category page with category name 'mobile'</div> <?php } ?>
Only for product category page with category name ‘mobile’ or ‘laptop’
<?php if(is_product_category( array( 'mobile', 'laptop' ) ) ) { ?> <div class="joint_btn">Only for product category page with category name 'mobile' or 'laptop'</div> <?php } ?>
Only for woocommerce product tag archive page
<?php if(is_product_tag() ) { ?> <div class="joint_btn">Only for woocommerce product tag archive page</div> <?php } ?>
Only for product tag archive page with tag name ‘mobile’
<?php if(is_product_tag( 'mobile' ) ) { ?> <div class="joint_btn">Only for product tag archive page with tag name 'mobile'</div> <?php } ?>
Only for product tag archive page with tag name ‘mobile’ or ‘laptop’
<?php if(is_product_tag( array( 'mobile', 'laptop' ) ) ) { ?> <div class="joint_btn">Only for product tag archive page with tag name 'mobile' or 'laptop'</div> <?php } ?>
Only for woocommerce single product page
<?php if(is_product() ) { ?> <div class="joint_btn">Only for woocommerce single product page</div> <?php } ?>
Only for woocommerce cart page
<?php if(is_cart() ) { ?> <div class="joint_btn">Only for woocommerce cart page</div> <?php } ?>
Only for woocommerce checkout page
<?php if(is_checkout() ) { ?> <div class="joint_btn">Only for woocommerce checkout page</div> <?php } ?>
Only for woocommerce customer’s account page
<?php if(is_account_page() ) { ?> <div class="joint_btn">Only for woocommerce customer’s account page</div> <?php } ?>