Skip to content

Instantly share code, notes, and snippets.

@KeylorCR
Created January 29, 2020 06:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save KeylorCR/04e96ea6535b5757b261983793afb26c to your computer and use it in GitHub Desktop.
Save KeylorCR/04e96ea6535b5757b261983793afb26c to your computer and use it in GitHub Desktop.
<?php
/**
** Add extra information to admin order actions column
** @keylocr - 29-01-2020
**/
function wc_custom_admin_order_actions_end($object) {
$order_id = $object->get_id();
$store = (!empty(get_post_meta($order_id, '_shipping_pickup_stores', true))) ? get_post_meta($order_id, '_shipping_pickup_stores', true) : '';
if(!empty($store)) :
?>
<p>
<strong class="title"><?php echo __('Pickup Store', 'wc-pickup-store') . ':' ?></strong>
<span class="data"><?= $store ?></span>
</p>
<?php
endif;
}
add_action('woocommerce_admin_order_actions_end', 'wc_custom_admin_order_actions_end', 99);
/**
** Add extra information to shipping address column
** @keylocr - 29-01-2020
**/
function wc_manage_shop_order_posts_custom_column( $column ) {
global $post;
if ($column == 'shipping_address') {
$order = wc_get_order( $post->ID );
$order_id = $order->get_id();
$store = (!empty(get_post_meta($order_id, '_shipping_pickup_stores', true))) ? get_post_meta($order_id, '_shipping_pickup_stores', true) : '';
if(!empty($store)) :
?>
<p>
<strong class="title"><?php echo __('Pickup Store', 'wc-pickup-store') . ':' ?></strong>
<span class="data"><?= $store ?></span>
</p>
<?php
endif;
}
}
add_action('manage_shop_order_posts_custom_column', 'wc_manage_shop_order_posts_custom_column', 99);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment