立即在主题中以产品悬停设置购买按钮

发布于 2025-02-04 13:22:27 字数 541 浏览 3 评论 0原文

我想为产品悬停添加一个“立即购买”按钮。就像客户不必单击并查看产品一样,但他或她可以单击“立即购买”按钮并立即重定向到结帐页面。

目前,该页面看起来像这样。

我想要这样的东西

我研究了很多并找到了一些插件。他们是报酬的。我还检查了代码,但我不是PHP开发人员,所以我不太了解代码。就像去哪里以及如何编辑等等等。

我使用的主题是Kapee。请让我知道,如果你们知道答案。预先感谢:)祝您有美好的一天!

I would like to add a 'Buy Now' button to product hover. like the customer doesn't have to click and view the product but he or she can click the buy now button and redirected to the checkout page immediately.

Currently, the page looks like this.
Current hover setting

and I want something like this
enter image description here

I researched a lot and found some plugins. They are paid. I also checked the codes but I am not a php developer so I didn't quite understand the code. like where to go and how to edit etc etc.

The theme I am using is Kapee. kindly let me know if you guys know the answer. Thanks in advance :) Have a nice day!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

囚我心虐我身 2025-02-11 13:22:27

添加到“购物车”按钮之后,在主题function.php文件中添加了代码。php文件。

// define the woocommerce_after_add_to_cart_button callback 

function action_woocommerce_after_add_to_cart_button(  ) { 
    // make action magic happen here... 
    $custom_url = home_url('/checkout/');
    ?>
    <a class="btn button" href="<?php echo esc_url($custom_url);?>">
        <?php
            echo esc_html__('Buy Now', 'textdomain');
        ?>
    </a>
    <?php
}; 
         
// add the action 
add_action( 'woocommerce_after_add_to_cart_button', 'action_woocommerce_after_add_to_cart_button', 10, 0 ); 

另外,您可以使用任何第三方插件,请参见插件链接

https://wordpress.org/plugins/woo-custom-add-to-cart-button/

Added the code in your theme functions.php file you will see a button after add to the cart button

// define the woocommerce_after_add_to_cart_button callback 

function action_woocommerce_after_add_to_cart_button(  ) { 
    // make action magic happen here... 
    $custom_url = home_url('/checkout/');
    ?>
    <a class="btn button" href="<?php echo esc_url($custom_url);?>">
        <?php
            echo esc_html__('Buy Now', 'textdomain');
        ?>
    </a>
    <?php
}; 
         
// add the action 
add_action( 'woocommerce_after_add_to_cart_button', 'action_woocommerce_after_add_to_cart_button', 10, 0 ); 

Also You can use any third-party plugin for this see the plugin link

https://wordpress.org/plugins/woo-custom-add-to-cart-button/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文