javascript - Disable element in php if/else -


what trying disable/hide button if condition satisfied
below code woocommerce website.

php

foreach( wc()->cart->get_cart() $cart_item_key => $values ) {     $_product = $values['data'];      if( get_the_id() == $_product->id ) {         //*disable button*//      }} 

html

<button class="test">...</button> 

try this

$btn='<button class="test" '.(get_the_id() == $_product->id ? "disabled" : "").">...</button>"; echo $btn; 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -