Learn Tutorials Point - LTP > WordPress > How to add action button on woocommerce admin order detail page in WordPress
How to add action button on woocommerce admin order detail page in WordPress
This code is used to add a button to your order page in the admin panel. and this code adds for the function.php file WordPress.
<?php add_action( 'woocommerce_order_item_add_action_buttons', 'action_woocommerce_order_item_add_action_buttons', 10, 1); function action_woocommerce_order_item_add_action_buttons( $order ){ $order_id = method_exists( $order, 'get_id' ) ? $order->get_id() : $order->id; $order = new WC_Order( $order_id ); $items = $order->get_items(); foreach ( $items as $item ) { $product_id = $item['product_id']; $meta = get_post_meta($product_id); $vender_product_link = get_post_meta($product_id, 'venderproductlink', true); if(!empty($vender_product_link)){ echo '<a class="button generate-items" target="_blank" href="'.$vender_product_link1.'">Vender Product Link</a>'; } } }; ?>
Author: Learn Tutorials Point
We Well organized and easy-to-understand Interactive tutorials With lots of examples of how to use Tutorials WordPress, PHP, Bootstrap, Bootstrap 4, HTML, CSS, AJAX, jQuery, Woocommerce, Post, Database, Javascript, Theme, Responsive, Templates.
Trending Posts
Tags
ACF
Ading custom columns
admin
Bootstrap
Cart Price
categories
Change Price
class
Code
comments
Create
Creating custom post Type
CSS
current
custom
Customizing
Custom Post
Custom Post Type
Custom Taxonomy
database
Date
Fatch
form
function
HTML
Image
Install
javascript
jQuery
Menu
PHP
Post
Post Type
Price
product
responsive
Resular price
Single product
Table
taxonomy
Theme
Title
woocommerce
Wordpress
Wordpress Code