admin管理员组文章数量:1336293
Will please someone help me why this happens. Firstly here is my code.
add_action( 'woocommerce_after_add_to_cart_form', 'sione_enquiry_button' );
add_action('woocommerce_cart_actions', 'sione_enquiry_button_new');
function sione_enquiry_button() {
if(!is_product()){
return;
}
if (has_term( 'blue-block-frames', 'product_cat' )) {
?>
<input disabled style="padding: 5px 20px;background: #193670!important;border: 0!important;color: white!important;" type="button" id="enquiry-button" class="btn enquiry-button" value="<?php echo __( 'Whatsapp your prescription to +918328120536 after purchase', 'orchid' ); ?>" />
<?php
} else {
?>
<input style="padding: 5px 20px;background: #193670!important;border: 0!important;color: white!important;" type="button" id="enquiry-button" class="btn enquiry-button" value="<?php echo __( 'Send Enquiry for Wholesale Price', 'orchid' ); ?>" />
<?php
}
}
function sione_enquiry_button_new() {
if(is_cart()) {
$check = false;
// check each cart item for our category
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
$product = $cart_item['data'];
// replace 'membership' with your category's slug
if ( has_term( 'blue-block-frames', 'product_cat', $product->id ) ) {
$check= true;
}
}
if($check == true) {
?>
<input disabled style="padding: 5px 20px;background: #193670!important;border: 0!important;color: white!important;" type="button" id="enquiry-button" class="btn enquiry-button" value="<?php echo __( 'Whatsapp your prescription to +918328120536 after purchase', 'orchid' ); ?>" />
<?php
} else {
?>
<input style="padding: 5px 20px;background: #193670!important;border: 0!important;color: white!important;" type="button" id="enquiry-button" class="btn enquiry-button" value="<?php echo __( 'Send Enquiry for Wholesale Price', 'orchid' ); ?>" />
<?php
}
}
}
Will someone please tell me why else statement
is showing even else
is false.
本文标签: categoriesIn ifelse conditionthe else statement shows even if if statement is correct
版权声明:本文标题:categories - In if...else condition, the else statement shows even if if statement is correct 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742405876a2468810.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论