简体   繁体   English

Woocommerce 产品详细信息页面删除添加到购物车并放置电子邮件按钮

[英]Woocommerce Product details page remove add to cart and put Email Button

In my woocommerce website for simple products, I need to remove Add to Cart, quantity box and put a Email Button with mail to link.在我的简单产品的 woocommerce 网站中,我需要删除添加到购物车、数量框并放置一个带有邮件链接的电子邮件按钮。 Can anyone please help me how can i do it.任何人都可以请帮助我我该怎么做。

Add This code snippet in active theme function.php file在活动主题 function.php 文件中添加此代码片段

// For remove Add to cart button
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart');

    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart');



    // add inquiry button into every product
    add_action( 'woocommerce_after_shop_loop_item', 'prfx_add_inquiry_button', 10); // catalog page
    add_action( 'woocommerce_single_product_summary', 'prfx_add_inquiry_button', 30); // single product page
    function prfx_add_inquiry_button() {
        $current_product_id = get_the_ID(); // get ID of the current post
        $current_product_title = get_the_title(); // get the title of the current post
        $product = wc_get_product( $current_product_id ); // get the product object
                echo $current_product_title;
                echo '<a href="mailto:test@example.com?subject=Inquiry for product id:$current_product_id" class="button">Inquiry</a>';
                echo '</a>';
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 woocommerce 添加到单个产品页面上的购物车按钮 - woocommerce add to cart button on single product page Woocommerce-如何删除产品列表上的“添加到购物车”按钮 - Woocommerce - How to remove the Add to Cart Button on product listing 删除 Woocommerce 中特定产品类别的添加购物车按钮 - Remove add cart button in Woocommerce for a specific product category Woocommerce-当用户是产品作者时,删除添加到购物车按钮 - Woocommerce - Remove add to cart button when user is the product author Woocommerce 滑动购物车 - 为每个产品添加删除按钮 - Woocommerce sliding cart - add remove button for each product 如何在单个产品页面上隐藏添加到购物车按钮 - woocommerce - How to hide add to cart button on single product page - woocommerce Woocommerce-在类别页面的产品列表中添加到购物车按钮和数量 - Woocommerce - add to cart button and quantity in product list on category page Woocommerce 产品页面重定向中断添加到购物车按钮 - Woocommerce product page redirect breaks add to cart button 添加到购物车按钮在 Woocommerce 的单个产品页面上不起作用 - Add to cart button not working on single product page in Woocommerce 在单个产品页面/ Wordpress / Woocommerce中禁用Ajax添加到购物车按钮 - Disable ajax for add to cart button in single product page / Wordpress / Woocommerce
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM