[英]Woocommerce / Wordpress - Add button to Order / Product Page on Admin Panel
I need to add a button and or text to both the order page and product page of the admin panel of woocommerce. 我需要在woocommerce管理面板的订单页面和产品页面上添加一个按钮和/或文本。 They are actually both types of
/wp-admin/post.php
but evidentally different post types. 它们实际上是
/wp-admin/post.php
两种类型,但是明显不同的帖子类型。 Is this possible? 这可能吗? I have look through the available hooks on the woocommerce list and the only ones I have tried actually put information on the listings page of each.
我查看了woocommerce列表中可用的钩子,我尝试过的唯一一个实际上将信息放在每个列表页面上。
Just looking for the filter/hook! 只是寻找过滤器/钩子!
Many thanks in advance, sorry for no code samples - not applicable as just looking for an identifier!! 非常感谢,不用没有代码示例 - 不适用于寻找标识符!
In order to add a custom button to the Woocommerce Order Page (On Admin Page) you need to use add_meta_boxes
wordpress action we can then use a filter for shop_order
so it only display on the woocommerce orders. 为了自定义按钮添加到Woocommerce订购页面(在管理页面),你需要使用
add_meta_boxes
WordPress的行动,那么我们就可以使用过滤器shop_order
所以它只能在woocommerce订单显示。 So code would look something like this... 所以代码看起来像这样......
add_action( 'add_meta_boxes', 'MY_order_meta_boxes' );
function MY_order_meta_boxes()
{
add_meta_box(
'woocommerce-order-YOUR-UNIQUE-REF',
__( 'The title of my box' ),
'order_meta_box_YOURCONTENT',
'shop_order',
'side',
'default'
);
}
function order_meta_box_YOURCONTENT()
{
echo '<button>New button</button>';
}
You then would want your button to do something, so it is work adding some JS into that last function also. 然后你会希望你的按钮做一些事情,所以将一些JS添加到最后一个函数中也是如此。 Then you are probably likely to want to use Wordpress AJAX which you can read about and see a demo here .
然后你可能想要使用Wordpress AJAX,你可以阅读并在这里看到一个演示。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.