/get-woocommerce-current-product-category-in-single-product-page.php
Last active May 22, 2019
Check for current product category in single product page (Woocommerce)
<?php | |
/* | |
URL: https://wproot.dev/blog/get-woocommerce-current-product-category-single-product-page/ | |
*/ | |
if ( has_term( 'tshirts', 'product_cat' ) ) //product category is tshirts | |
{ | |
$flatrate = '10.00'; | |
} | |
elseif ( has_term( 'hoodies', 'product_cat' ) ) //product category is hoodies | |
{ | |
$flatrate = '15.00'; | |
} | |
else | |
{ | |
$flatrate = '0.00'; | |
} | |
echo 'USD'.$flatrate.' Flat Rate Shipping'; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment