Answers for "if product open display this button"

PHP
0

if product open display this button

remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30, 0);
Posted by: Guest on February-24-2021
0

if product open display this button

add_action( 'woocommerce_single_product_summary', 'custom_button_by_categories', 32 ,0 );
function custom_button_by_categories(){
    
    global $product;

    // Define your categories in this array (can be Ids, slugs or names)
    $product_cats = array('clothing', 'music', 'furnitures');

    if( has_term( $product_cats, 'product_cat', $product->get_id() ) ){
         $demo_url = get_post_meta( $product->get_id(), 'demo_url', true );
         echo '<a class="fancybox iframe" data-width="1280" data-height="720" href="'.$demo_url.'"><button style="background: lightblue; padding-left: 19px; padding-right: 19px;">Przymierz</button></a>';
    }
}
Posted by: Guest on February-24-2021

Code answers related to "if product open display this button"

Browse Popular Code Answers by Language