/*
Theme Name: Flatsome Child
Description: This is a child theme for Flatsome Theme
Author: UX Themes
Template: flatsome
Version: 3.0
*/

/*************** ADD CUSTOM CSS HERE.   ***************/


@media only screen and (max-width: 48em) {
/*************** ADD MOBILE ONLY CSS HERE  ***************/


}

// Remove Add to Cart buttons from product pages and shop catalog pages
remove_action('woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart');
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_product_add_to_cart', 30);

// Optional: Hide product prices everywhere
remove_action('woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10);
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_product_price', 10);



add_action('woocommerce_single_product_summary', 'add_whatsapp_button', 30);
function add_whatsapp_button() {
    global $product;
    $phone_number = '15551234567'; // Replace with your full international phone number (no zeros, no + sign)
    $product_name = urlencode(get_the_title());
    $product_url = urlencode(get_permalink());
    
    // Create WhatsApp link with a pre-filled product inquiry message
    $whatsapp_url = "https://wa.me{$phone_number}?text=Hello,%20I%20am%20interested%20in%20{$product_name}%20({$product_url})";
    
    echo '<a href="' . esc_url($whatsapp_url) . '" class="button whatsapp-order-btn" target="_blank" style="background-color: #25D366; color: white; padding: 12px 20px; font-weight: bold; border-radius: 4px; display: inline-block; margin-top: 15px; text-decoration: none;">Order via WhatsApp</a>';
}

