【问题标题】:Adding a button to order details on 'My Account' page in WooCommerce在 WooCommerce 的“我的帐户”页面上添加一个按钮以订购详细信息
【发布时间】:2019-07-01 08:08:04
【问题描述】:

除了“再次订购”按钮之外,是否有 Woocommerce 钩子/过滤器可以添加另一个按钮?我想将此添加到“我的帐户”>“我的订单”>“订单详情”页面。

【问题讨论】:

    标签: woocommerce hook-woocommerce


    【解决方案1】:

    有两种方法可以将按钮添加到您的我的帐户页面(在任何 WooCommerce 页面中进行更改):

    1. 使用 WooCommerce 钩子/过滤器:
    add_action('woocommerce_order_details_after_order_table', 'jamy_add_button');
    
    function jamy_add_button($order) {
        /* Your code */
        echo "Your button html code";
    }
    
    1. 覆盖 WooCommerce 模板:
    Copy your `/wp-content/plugins/woocommerce/templates/order/order-details.php` file to `/wp-content/theme/your_theme/woocommerce/order/order-details.php`.
    
    Then edit or add the button to the copied file as your needs.
    

    【讨论】:

      猜你喜欢
      • 2018-06-21
      • 1970-01-01
      • 1970-01-01
      • 2016-04-30
      • 1970-01-01
      • 2019-04-10
      • 2021-08-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多