Home Forums WoodMart support forum Buy via WhatsApp button

Buy via WhatsApp button

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #556909

    sergenadiyaman
    Participant

    Hello
    I created code for product page it works normally.
    But I use furniture 2 version with custom layout. I need to add code after share button. How can I show in custom layout

    #557039

    Hello,

    Can you please tell us which code you want to add in the layout.

    Best Regards.

    #557059

    sergenadiyaman
    Participant
    // WhatsApp ile ürünü satın alma butonunu ekleyen işlev
    function add_whatsapp_buy_button() {
        global $product;
    
        // Ürün başlığını ve URL'sini al
        $product_title = $product->get_title();
        $product_url = get_permalink($product->get_id());
    
        // WhatsApp butonunu oluştur
        echo '<a href="https://api.whatsapp.com/send?phone=+900111111111111&text=Hello,%20I%20want%20to%20buy:%20' . $product_title . '%20(' . $product_url . ')" target="_blank" rel="noopener">';
        echo 'Purchase on Whatsapp <i class="fa fa-whatsapp" style="color: #ffffff;"></i>'; // FontAwesome ikonunu ekledik
        echo '</a>';
    }
    
    // WooCommerce ürün sayfasının altına WhatsApp butonunu ekle
    add_action('woocommerce_product_meta_start', 'add_whatsapp_buy_button', 20);
    #557094

    Hello,

    Define the code in the functions.php file in your child theme.

    Best Regards.

Viewing 4 posts - 1 through 4 (of 4 total)