add to cart button shortcode
Tue Jan 31 2023 09:01:15 GMT+0000 (Coordinated Universal Time)
Saved by
@itaiki
add_action( 'woocommerce_before_add_to_cart_button', 'misha_before_add_to_cart_btn' );
function misha_before_add_to_cart_btn(){
global $product;
global $post;
$terms = get_the_terms( $product->get_id(), 'product_cat');
$carArray = array();
if(is_array($terms)) {
foreach($terms as $term) {
$carArray[] = $term->term_id;
}
}
if(in_array(17, $carArray) && !in_array(55, $carArray) && $product->get_id() !== 27582 && $product->get_id() !== 80696 && $product->get_id() !== 77759 && $product->get_id() !== 99336) {
echo do_shortcode('[elementor-template id="75039"]');
echo '
<style>
.woobt-wrap.woobt-layout-default .woobt-product-this {
display: none;
}
button.single_add_to_cart_button {
display: none !important;
}
button.bundle_add_to_cart_button {
display: block !important;
}
.woobt-wrap a.woosq-link {
font-family: almony;
font-size: 16px;
color: #000 !important;
font-weight: 400;
}
@media only screen and (max-width: 767px) {
.woobt-wrap-responsive .woobt-products .woobt-product {
flex-direction: unset !important;
}
}
</style>
';
echo do_shortcode('[woobt]').'<br>';
}
}
content_copyCOPY
Comments