Skip to content
Advertisement

Change order item custom meta data displayed label and value in WooCommerce Admin orders

In the Woocommerce admin screen, I’m attempting to use the order line meta data to display a button which will open up a new window with the URL of the dropship supplier. I have successfully pulled the supplier URL from the product on order and pushed it to the order line item.

I am able to change the meta data to a button but the consequence of that is the other custom fields which contain the custom options are wiped.

This is the full code which I have added to the functions.php file

JavaScript

These images show the before and after of using the last block of code.

Before:

Before

After:

After

Where have I gone wrong with my code and is what i’m trying to achieve possible?

Advertisement

Answer

The main mistake is on last function where $display_value should be replaced with just $value and then return $value; should be located at the end before last closing bracket.

I have also revisited all your code:

JavaScript

Code goes in functions.php file of the active child theme (or active theme). Tested and works.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement