Its when I open the order edit.
Your hpos implementation also doesn’t dump all the five order item data.
I fixed both of the problems. Here are the source files
order_data.php
<?php
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! empty( $order_data ) ) : ?>
<table class="widefat striped" style="font-family:monospace; text-align:left; width:100%;">
<tbody>
<?php foreach ( $order_data as $key => $data ) : ?>
<?php if ( 'meta_data' === $key ) : ?>
<?php foreach ( $data as $meta ) : ?>
<tr>
<th style="width:20%;"><?php echo 'meta_data[' . esc_html( $meta->get_data()['key'] ) . ']'; ?></th>
<td>
<?php
$data = $meta->get_data()['value'];
switch ( $data ) {
case is_array( $data ):
echo '<pre>' . esc_html( print_r( $data, true ) ) . '</pre>';
break;
case is_object( $data ):
echo '<pre>' . esc_html( print_r( $data, true ) ) . '</pre>';
break;
default:
echo esc_html( $data );
break;
}
?>
</td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr>
<th style="width:20%;"><?php echo esc_html( $key ); ?></th>
<td>
<?php
switch ( $data ) {
case is_array( $data ):
echo '<pre>' . esc_html( print_r( $data, true ) ) . '</pre>';
break;
case is_object( $data ):
echo '<pre>' . esc_html( print_r( $data, true ) ) . '</pre>';
break;
default:
echo esc_html( $data );
break;
}
?>
</td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
</tbody>
</table>
<?php else : ?>
<p>No order data is associated with this Order.</p>
<?php endif; ?>
meta_box.php
<?php
use Automattic\WooCommerce\Utilities\OrderUtil;
use Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController;
require_once WOO_ST_PATH . 'includes/admin/meta_box.php';
function woo_st_add_data_meta_boxes( $post_type, $post = '' ) {
if ( get_post_status( $post ) == 'auto-draft' ) {
return;
}
// Product
$post_type = 'product';
if ( apply_filters( 'woo_st_product_data_meta_box', true ) ) {
add_meta_box( 'woo-product-post_data', __( 'Product Post Meta', 'woocommerce-store-toolkit' ), 'woo_st_product_data_meta_box', $post_type, 'normal', 'default' );
}
$post_type = 'product_variation';
if ( apply_filters( 'woo_st_product_data_meta_box', true ) ) {
add_meta_box( 'woo-product-post_data', __( 'Product Post Meta', 'woocommerce-store-toolkit' ), 'woo_st_product_data_meta_box', $post_type, 'normal', 'default' );
}
// Order
$post_type = 'shop_order';
$post_type = wc_get_container()->get( CustomOrdersTableController::class )->custom_orders_table_usage_is_enabled()
? wc_get_page_screen_id( 'shop-order' )
: 'shop_order';
$order_meta_box_title = wc_get_container()->get( CustomOrdersTableController::class )->custom_orders_table_usage_is_enabled()
? array(
'order' => __( 'Order Data', 'woocommerce-store-toolkit' ),
'items' => __( 'Order Items Data', 'woocommerce-store-toolkit' ),
'refunds' => __( 'Refunds Data', 'woocommerce-store-toolkit' ),
) : array(
'order' => __( 'Order Post Meta', 'woocommerce-store-toolkit' ),
'items' => __( 'Order Items Meta', 'woocommerce-store-toolkit' ),
'refunds' => __( 'Refunds Post Meta', 'woocommerce-store-toolkit' ),
);
if ( apply_filters( 'woo_st_order_data_meta_box', true ) ) {
add_meta_box( 'woo-order-post_data', $order_meta_box_title['order'], 'woo_st_order_data_meta_box', $post_type, 'normal', 'default' );
}
if ( apply_filters( 'woo_st_order_items_data_meta_box', true ) ) {
add_meta_box( 'woo-order-post_item', $order_meta_box_title['items'], 'woo_st_order_items_data_meta_box', $post_type, 'normal', 'default' );
}
if ( apply_filters( 'woo_st_order_refunds_data_meta_box', true ) ) {
add_meta_box( 'woo-order-post_refund', $order_meta_box_title['refunds'], 'woo_st_order_refunds_data_meta_box', $post_type, 'normal', 'default' );
}
// So we can view the Related Orders meta box on the Edit Order screen
$unlock_related_orders = get_option( WOO_ST_PREFIX . '_unlock_related_orders', 0 );
if (
! empty( $unlock_related_orders ) ||
apply_filters( 'woo_st_order_related_orders_meta_box', false )
) {
add_meta_box( 'woo-order-related_orders', __( 'Related Orders', 'woocommerce-store-toolkit' ), 'woo_st_order_related_orders_meta_box', $post_type, 'side', 'default' );
}
// Coupon
$post_type = 'shop_coupon';
if ( apply_filters( 'woo_st_coupon_data_meta_box', true ) ) {
add_meta_box( 'woo-coupon-post_data', __( 'Coupon Post Meta', 'woocommerce-store-toolkit' ), 'woo_st_coupon_data_meta_box', $post_type, 'normal', 'default' );
}
// Attachment
$post_type = 'attachment';
if ( apply_filters( 'woo_st_attachment_data_meta_box', true ) ) {
add_meta_box( 'attachment-post_data', __( 'Attachment Post Meta', 'woocommerce-store-toolkit' ), 'woo_st_attachment_data_meta_box', $post_type, 'normal', 'default' );
}
// 3rd party
// WooCommerce Subscriptions - https://www.woothemes.com/products/woocommerce-subscriptions/
$post_type = 'shop_subscription';
if ( post_type_exists( $post_type ) ) {
if ( apply_filters( 'woo_st_order_data_meta_box', true ) ) {
add_meta_box( 'woo-order-post_data', __( 'Subscription Post Meta', 'woocommerce-store-toolkit' ), 'woo_st_order_data_meta_box', $post_type, 'normal', 'default' );
}
}
// WooCommerce - Store Exporter Deluxe - https://www.visser.com.au/plugins/store-exporter-deluxe/
$post_type = 'scheduled_export';
if ( post_type_exists( $post_type ) ) {
if ( apply_filters( 'woo_st_scheduled_export_data_meta_box', true ) ) {
add_meta_box( 'woo-scheduled_export-post_data', __( 'Scheduled Export Post Meta', 'woocommerce-store-toolkit' ), 'woo_st_scheduled_export_data_meta_box', $post_type, 'normal', 'default' );
}
}
// WooCommerce - Store Exporter Deluxe - https://www.visser.com.au/plugins/store-exporter-deluxe/
$post_type = 'export_template';
if ( apply_filters( 'woo_st_export_template_data_meta_box', true ) ) {
add_meta_box( 'woo-coupon-post_data', __( 'Export Template Post Meta', 'woocommerce-store-toolkit' ), 'woo_st_export_template_data_meta_box', $post_type, 'normal', 'default' );
}
// WooCommerce - Product Importer Deluxe - https://www.visser.com.au/plugins/product-importer-deluxe/
$post_type = 'scheduled_import';
if ( post_type_exists( $post_type ) ) {
if ( apply_filters( 'woo_st_scheduled_import_data_meta_box', true ) ) {
add_meta_box( 'woo-scheduled_import-post_data', __( 'Scheduled Import Post Meta', 'woocommerce-store-toolkit' ), 'woo_st_scheduled_export_data_meta_box', $post_type, 'normal', 'default' );
}
}
// WooCommerce Events - https://www.woocommerceevents.com/
if ( class_exists( 'WooCommerce_Events' ) ) {
$post_type = 'event_magic_tickets';
if ( apply_filters( 'woo_st_event_data_meta_box', true ) ) {
add_meta_box( 'woo-event-post_data', __( 'Event Post Meta', 'woocommerce-store-toolkit' ), 'woo_st_event_data_meta_box', $post_type, 'normal', 'default' );
}
}
// WooCommerce Bookings - https://www.woothemes.com/products/woocommerce-bookings/
if ( class_exists( 'WC_Bookings' ) ) {
$post_type = 'wc_booking';
if ( apply_filters( 'woo_st_booking_data_meta_box', true ) ) {
add_meta_box( 'woo-booking-post_data', __( 'Booking Post Meta', 'woocommerce-store-toolkit' ), 'woo_st_booking_data_meta_box', $post_type, 'normal', 'default' );
}
}
// WooCommerce Memberships - https://www.woothemes.com/products/woocommerce-memberships/
if ( function_exists( 'init_woocommerce_memberships' ) ) {
$post_type = 'wc_user_membership';
if ( apply_filters( 'woo_st_user_membership_data_meta_box', true ) ) {
add_meta_box( 'woo-user_membership-post_data', __( 'User Membership Post Meta', 'woocommerce-store-toolkit' ), 'woo_st_user_membership_data_meta_box', $post_type, 'normal', 'low' );
}
$post_type = 'wc_membership_plan';
if ( apply_filters( 'woo_st_membership_plan_data_meta_box', true ) ) {
add_meta_box( 'woo-membership_plan-post_data', __( 'Membership Plan Post Meta', 'woocommerce-store-toolkit' ), 'woo_st_membership_plan_data_meta_box', $post_type, 'normal', 'low' );
}
// These guys think they are special...
add_filter( 'wc_memberships_allowed_meta_box_ids', 'woo_st_extend_wc_memberships_allowed_meta_box_ids' );
}
// WooCommerce Appointments - https://www.bizzthemes.com/plugins/woocommerce-appointments/
if ( class_exists( 'WC_Appointments' ) ) {
$post_type = 'wc_appointment';
if ( apply_filters( 'woo_st_appointment_data_meta_box', true ) ) {
add_meta_box( 'woo-appointment-post_data', __( 'Appointment Post Meta', 'woocommerce-store-toolkit' ), 'woo_st_generic_data_meta_box', $post_type, 'normal', 'low' );
}
}
// Advanced Custom Fields - https://www.advancedcustomfields.com
if ( class_exists( 'acf' ) ) {
$acf_version = ( defined( 'ACF_VERSION' ) ? ACF_VERSION : false );
if ( version_compare( $acf_version, '5.6', '>=' ) ) {
$post_type = 'acf-field-group';
} else {
$post_type = 'acf';
}
if ( apply_filters( 'woo_st_acf_data_meta_box', true ) ) {
add_meta_box( 'woo-acf-post_data', __( 'ACF Post Meta', 'woocommerce-store-toolkit' ), 'woo_st_generic_data_meta_box', $post_type, 'normal', 'low' );
}
}
}
// WooCommerce Memberships - https://www.woothemes.com/products/woocommerce-memberships/
function woo_st_extend_wc_memberships_allowed_meta_box_ids( $meta_boxes ) {
$meta_boxes[] = 'woo-user_membership-post_data';
$meta_boxes[] = 'woo-membership_plan-post_data';
return $meta_boxes;
}
function woo_st_product_data_meta_box() {
global $post;
$post_id = absint( $post->ID ? $post->ID : false );
$post_meta = get_post_custom( $post_id );
$type = 'product';
$template = 'post_data.php';
if ( file_exists( WOO_ST_PATH . 'templates/admin/' . $template ) ) {
include_once WOO_ST_PATH . 'templates/admin/' . $template;
} else {
$message = sprintf( __( 'We couldn\'t load the template file <code>%1$s</code> within <code>%2$s</code>, this file should be present.', 'woocommerce-store-toolkit' ), $template, WOO_ST_PATH . 'includes/admin/...' );
?>
<p><strong><?php echo wp_kses_data( $message ); ?></strong></p>
<p><?php _e( 'You can see this error for one of a few common reasons', 'woocommerce-store-toolkit' ); ?>:</p>
<ul class="ul-disc">
<li><?php _e( 'WordPress was unable to create this file when the Plugin was installed or updated', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin files have been recently changed and there has been a file conflict', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin file has been locked and cannot be opened by WordPress', 'woocommerce-store-toolkit' ); ?></li>
</ul>
<p><?php _e( 'Jump onto our website and download a fresh copy of this Plugin as it might be enough to fix this issue. If this persists get in touch with us.', 'woocommerce-store-toolkit' ); ?></p>
<?php
}
}
function woo_st_order_data_meta_box( $post_or_order_object ) {
if ( OrderUtil::custom_orders_table_usage_is_enabled() ) {
$order = ( $post_or_order_object instanceof WP_Post ) ? wc_get_order( $post_or_order_object->ID ) : $post_or_order_object;
$order_data = $order->get_data();
// Unset line items, tax lines, shipping lines, fee lines, coupon lines and refunds.
unset( $order_data['line_items'] );
unset( $order_data['tax_lines'] );
unset( $order_data['shipping_lines'] );
unset( $order_data['fee_lines'] );
unset( $order_data['coupon_lines'] );
unset( $order_data['refunds'] );
$template = 'order_data.php';
} else {
global $post;
$post_id = absint( $post->ID ? $post->ID : false );
$post_meta = get_post_custom( $post_id );
$type = 'order';
$template = 'post_data.php';
}
if ( file_exists( WOO_ST_PATH . 'templates/admin/' . $template ) ) {
include_once WOO_ST_PATH . 'templates/admin/' . $template;
} else {
$message = sprintf( __( 'We couldn\'t load the template file <code>%1$s</code> within <code>%2$s</code>, this file should be present.', 'woocommerce-store-toolkit' ), $template, WOO_ST_PATH . 'includes/admin/...' );
?>
<p><strong><?php echo wp_kses_data( $message ); ?></p>
<p><?php _e( 'You can see this error for one of a few common reasons', 'woocommerce-store-toolkit' ); ?>:</p>
<ul class="ul-disc">
<li><?php _e( 'WordPress was unable to create this file when the Plugin was installed or updated', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin files have been recently changed and there has been a file conflict', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin file has been locked and cannot be opened by WordPress', 'woocommerce-store-toolkit' ); ?></li>
</ul>
<p><?php _e( 'Jump onto our website and download a fresh copy of this Plugin as it might be enough to fix this issue. If this persists get in touch with us.', 'woocommerce-store-toolkit' ); ?></p>
<?php
}
}
function woo_st_order_items_data_meta_box( $post_or_order_object ) {
if ( OrderUtil::custom_orders_table_usage_is_enabled() ) {
$template = 'order_item_data_hpos.php';
if ( !file_exists( WOO_ST_PATH . 'templates/admin/' . $template ) ) {
$message = sprintf( __( 'We couldn\'t load the template file <code>%1$s</code> within <code>%2$s</code>, this file should be present.', 'woocommerce-store-toolkit' ), $template, WOO_ST_PATH . 'includes/admin/...' );
}
else {
$order = ( $post_or_order_object instanceof WP_Post ) ? wc_get_order( $post_or_order_object->ID ) : $post_or_order_object;
foreach (['line_item','tax','shipping','fee','coupon'] as $type) {
$order_items = $order->get_items($type);
include WOO_ST_PATH . 'templates/admin/' . $template;
}
}
} else {
global $wpdb;
$post = $post_or_order_object instanceof WP_Post ? $post_or_order_object : false;
$post_id = absint( $post->ID ? $post->ID : false );
$order_items_sql = $wpdb->prepare( 'SELECT
order_item_id
as id, order_item_name
as name, order_item_type
as type FROM ' . $wpdb->prefix . 'woocommerce_order_items
WHERE order_id
= %d', $post_id );
if ( $order_items = $wpdb->get_results( $order_items_sql ) ) {
foreach ( $order_items as $key => $order_item ) {
$order_itemmeta_sql = $wpdb->prepare( 'SELECT meta_key
, meta_value
FROM ' . $wpdb->prefix . 'woocommerce_order_itemmeta
AS order_itemmeta WHERE order_item_id
= %d ORDER BY order_itemmeta
.meta_key
ASC', $order_item->id );
$order_items[ $key ]->meta = $wpdb->get_results( $order_itemmeta_sql );
}
}
$type = 'order_item';
$template = 'order_item_data.php';
if ( file_exists( WOO_ST_PATH . 'templates/admin/' . $template ) ) {
include_once WOO_ST_PATH . 'templates/admin/' . $template;
} else {
$message = sprintf( __( 'We couldn\'t load the template file <code>%1$s</code> within <code>%2$s</code>, this file should be present.', 'woocommerce-store-toolkit' ), $template, WOO_ST_PATH . 'includes/admin/...' );
}
}
if (!empty($message)) {
?>
<p><strong><?php echo wp_kses_data( $message ); ?></strong></p>
<p><?php _e( 'You can see this error for one of a few common reasons', 'woocommerce-store-toolkit' ); ?>:</p>
<ul class="ul-disc">
<li><?php _e( 'WordPress was unable to create this file when the Plugin was installed or updated', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin files have been recently changed and there has been a file conflict', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin file has been locked and cannot be opened by WordPress', 'woocommerce-store-toolkit' ); ?></li>
</ul>
<p><?php _e( 'Jump onto our website and download a fresh copy of this Plugin as it might be enough to fix this issue. If this persists get in touch with us.', 'woocommerce-store-toolkit' ); ?></p>
<?php
}
}
function woo_st_order_refunds_data_meta_box( $post_or_order_object ) {
if ( OrderUtil::custom_orders_table_usage_is_enabled() ) {
$order = ( $post_or_order_object instanceof WP_Post ) ? wc_get_order( $post_or_order_object->ID ) : $post_or_order_object;
$order_refunds = $order->get_refunds();
$type = 'refund';
$template = 'order_refund_data_hpos.php';
} else {
$post = $post_or_order_object instanceof WP_Post ? $post_or_order_object : false;
$post_id = absint( $post->ID ? $post->ID : false );
$refunds = woo_st_get_order_refunds( $post_id );
$type = 'refund';
$template = 'order_refund_data.php';
}
if ( file_exists( WOO_ST_PATH . 'templates/admin/' . $template ) ) {
include_once WOO_ST_PATH . 'templates/admin/' . $template;
} else {
$message = sprintf( __( 'We couldn\'t load the template file <code>%1$s</code> within <code>%2$s</code>, this file should be present.', 'woocommerce-store-toolkit' ), $template, WOO_ST_PATH . 'includes/admin/...' );
?>
<p><strong><?php echo wp_kses_data( $message ); ?></strong></p>
<p><?php _e( 'You can see this error for one of a few common reasons', 'woocommerce-store-toolkit' ); ?>:</p>
<ul class="ul-disc">
<li><?php _e( 'WordPress was unable to create this file when the Plugin was installed or updated', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin files have been recently changed and there has been a file conflict', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin file has been locked and cannot be opened by WordPress', 'woocommerce-store-toolkit' ); ?></li>
</ul>
<p><?php _e( 'Jump onto our website and download a fresh copy of this Plugin as it might be enough to fix this issue. If this persists get in touch with us.', 'woocommerce-store-toolkit' ); ?></p>
<?php
}
}
function woo_st_order_related_orders_meta_box( $post_or_order_object ) {
$orders = array();
$order = ( $post_or_order_object instanceof WP_Post ) ? wc_get_order( $post_or_order_object->ID ) : $post_or_order_object;
$user_id = $order->get_customer_id();
$matching = false;
if ( ! empty( $user_id ) ) {
$matching = 'user_id';
// Check if a User has been linked to this Order.
$args = array(
'return' => 'ids',
);
$orders = woo_st_get_user_orders( $user_id, $args );
} else {
$matching = 'billing_email';
// Fallback to the Billing e-mail address
$billing_email = get_post_meta( $post_id, '_billing_email', true );
if ( ! empty( $billing_email ) ) {
$post_type = 'shop_order';
$args = array(
'post_type' => $post_type,
'fields' => 'ids',
);
$args['post_status'] = ( function_exists( 'wc_get_order_statuses' ) ? apply_filters( 'woo_st_order_post_status', array_keys( wc_get_order_statuses() ) ) : 'any' );
$args['meta_query'][] = array(
'key' => '_billing_email',
'value' => $billing_email,
);
$order_ids = new WP_Query( $args );
$orders = ( ! empty( $order_ids->posts ) ? $order_ids->posts : false );
}
}
// Remove this Order from the list.
if ( ! empty( $orders ) ) {
$needle = array_search( $order->get_id(), $orders );
if ( false !== $needle ) {
unset( $orders[ $needle ] );
}
}
$type = 'order';
$template = 'order_related_orders.php';
if ( file_exists( WOO_ST_PATH . 'templates/admin/' . $template ) ) {
include_once WOO_ST_PATH . 'templates/admin/' . $template;
} else {
$message = sprintf( __( 'We couldn\'t load the template file <code>%1$s</code> within <code>%2$s</code>, this file should be present.', 'woocommerce-store-toolkit' ), $template, WOO_ST_PATH . 'includes/admin/...' );
?>
<p><strong><?php echo wp_kses_data( $message ); ?></strong></p>
<p><?php _e( 'You can see this error for one of a few common reasons', 'woocommerce-store-toolkit' ); ?>:</p>
<ul class="ul-disc">
<li><?php _e( 'WordPress was unable to create this file when the Plugin was installed or updated', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin files have been recently changed and there has been a file conflict', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin file has been locked and cannot be opened by WordPress', 'woocommerce-store-toolkit' ); ?></li>
</ul>
<p><?php _e( 'Jump onto our website and download a fresh copy of this Plugin as it might be enough to fix this issue. If this persists get in touch with us.', 'woocommerce-store-toolkit' ); ?></p>
<?php
}
}
function woo_st_coupon_data_meta_box() {
global $post;
$post_id = absint( $post->ID ? $post->ID : false );
$post_meta = get_post_custom( $post_id );
$type = 'coupon';
$template = 'post_data.php';
if ( file_exists( WOO_ST_PATH . 'templates/admin/' . $template ) ) {
include_once WOO_ST_PATH . 'templates/admin/' . $template;
} else {
$message = sprintf( __( 'We couldn\'t load the template file <code>%1$s</code> within <code>%2$s</code>, this file should be present.', 'woocommerce-store-toolkit' ), $template, WOO_ST_PATH . 'includes/admin/...' );
?>
<p><strong><?php echo wp_kses_data( $message ); ?></strong></p>
<p><?php _e( 'You can see this error for one of a few common reasons', 'woocommerce-store-toolkit' ); ?>:</p>
<ul class="ul-disc">
<li><?php _e( 'WordPress was unable to create this file when the Plugin was installed or updated', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin files have been recently changed and there has been a file conflict', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin file has been locked and cannot be opened by WordPress', 'woocommerce-store-toolkit' ); ?></li>
</ul>
<p><?php _e( 'Jump onto our website and download a fresh copy of this Plugin as it might be enough to fix this issue. If this persists get in touch with us.', 'woocommerce-store-toolkit' ); ?></p>
<?php
}
}
function woo_st_export_template_data_meta_box() {
global $post;
$post_id = absint( $post->ID ? $post->ID : false );
$post_meta = get_post_custom( $post_id );
$type = 'export_template';
$template = 'post_data.php';
if ( file_exists( WOO_ST_PATH . 'templates/admin/' . $template ) ) {
include_once WOO_ST_PATH . 'templates/admin/' . $template;
} else {
$message = sprintf( __( 'We couldn\'t load the template file <code>%1$s</code> within <code>%2$s</code>, this file should be present.', 'woocommerce-store-toolkit' ), $template, WOO_ST_PATH . 'includes/admin/...' );
?>
<p><strong><?php echo wp_kses_data( $message ); ?></strong></p>
<p><?php _e( 'You can see this error for one of a few common reasons', 'woocommerce-store-toolkit' ); ?>:</p>
<ul class="ul-disc">
<li><?php _e( 'WordPress was unable to create this file when the Plugin was installed or updated', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin files have been recently changed and there has been a file conflict', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin file has been locked and cannot be opened by WordPress', 'woocommerce-store-toolkit' ); ?></li>
</ul>
<p><?php _e( 'Jump onto our website and download a fresh copy of this Plugin as it might be enough to fix this issue. If this persists get in touch with us.', 'woocommerce-store-toolkit' ); ?></p>
<?php
}
}
function woo_st_category_data_meta_box( $term = '', $taxonomy = '' ) {
$term_taxonomy = 'product_cat';
$term_meta = get_term_meta( $term->term_id );
// We support up to 5 levels deep; can be extended further as needed
// Term
$category_heirachy = $term->name;
$category_depth = 1;
if ( ! empty( $term->parent ) ) {
// Term > Term
$parent = get_term( $term->parent );
if ( ! is_wp_error( $parent ) ) {
++$category_depth;
$category_heirachy = $parent->name . ' » ' . $category_heirachy;
// Term > Term > Term
$parent = get_term( $parent->parent );
if ( ! is_wp_error( $parent ) ) {
++$category_depth;
$category_heirachy = $parent->name . ' » ' . $category_heirachy;
// Term > Term > Term > Term
$parent = get_term( $parent->parent );
if ( ! is_wp_error( $parent ) ) {
++$category_depth;
$category_heirachy = $parent->name . ' » ' . $category_heirachy;
// Term > Term > Term > Term > Term
$parent = get_term( $parent->parent );
if ( ! is_wp_error( $parent ) ) {
$category_heirachy = $parent->name . ' » ' . $category_heirachy;
}
}
}
}
}
$type = 'category';
$class = 'category_data';
$template = 'term_data.php';
if ( file_exists( WOO_ST_PATH . 'templates/admin/' . $template ) ) {
include_once WOO_ST_PATH . 'templates/admin/' . $template;
} else {
$message = sprintf( __( 'We couldn\'t load the template file <code>%1$s</code> within <code>%2$s</code>, this file should be present.', 'woocommerce-store-toolkit' ), $template, WOO_ST_PATH . 'includes/admin/...' );
?>
<p><strong><?php echo wp_kses_data( $message ); ?></strong></p>
<p><?php _e( 'You can see this error for one of a few common reasons', 'woocommerce-store-toolkit' ); ?>:</p>
<ul class="ul-disc">
<li><?php _e( 'WordPress was unable to create this file when the Plugin was installed or updated', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin files have been recently changed and there has been a file conflict', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin file has been locked and cannot be opened by WordPress', 'woocommerce-store-toolkit' ); ?></li>
</ul>
<p><?php _e( 'Jump onto our website and download a fresh copy of this Plugin as it might be enough to fix this issue. If this persists get in touch with us.', 'woocommerce-store-toolkit' ); ?></p>
<?php
}
$template = 'category_data.php';
if ( file_exists( WOO_ST_PATH . 'templates/admin/' . $template ) ) {
include_once WOO_ST_PATH . 'templates/admin/' . $template;
} else {
$message = sprintf( __( 'We couldn\'t load the template file <code>%1$s</code> within <code>%2$s</code>, this file should be present.', 'woocommerce-store-toolkit' ), $template, WOO_ST_PATH . 'includes/admin/...' );
?>
<p><strong><?php echo wp_kses_data( $message ); ?></strong></p>
<p><?php _e( 'You can see this error for one of a few common reasons', 'woocommerce-store-toolkit' ); ?>:</p>
<ul class="ul-disc">
<li><?php _e( 'WordPress was unable to create this file when the Plugin was installed or updated', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin files have been recently changed and there has been a file conflict', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin file has been locked and cannot be opened by WordPress', 'woocommerce-store-toolkit' ); ?></li>
</ul>
<p><?php _e( 'Jump onto our website and download a fresh copy of this Plugin as it might be enough to fix this issue. If this persists get in touch with us.', 'woocommerce-store-toolkit' ); ?></p>
<?php
}
}
function woo_st_tag_data_meta_box( $term = '', $taxonomy = '' ) {
$term_taxonomy = 'product_tag';
$term_meta = get_term_meta( $term->term_id );
$type = 'tag';
$class = 'tag_data';
$template = 'term_data.php';
if ( file_exists( WOO_ST_PATH . 'templates/admin/' . $template ) ) {
include_once WOO_ST_PATH . 'templates/admin/' . $template;
} else {
$message = sprintf( __( 'We couldn\'t load the template file <code>%1$s</code> within <code>%2$s</code>, this file should be present.', 'woocommerce-store-toolkit' ), $template, WOO_ST_PATH . 'includes/admin/...' );
?>
<p><strong><?php echo wp_kses_data( $message ); ?></strong></p>
<p><?php _e( 'You can see this error for one of a few common reasons', 'woocommerce-store-toolkit' ); ?>:</p>
<ul class="ul-disc">
<li><?php _e( 'WordPress was unable to create this file when the Plugin was installed or updated', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin files have been recently changed and there has been a file conflict', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin file has been locked and cannot be opened by WordPress', 'woocommerce-store-toolkit' ); ?></li>
</ul>
<p><?php _e( 'Jump onto our website and download a fresh copy of this Plugin as it might be enough to fix this issue. If this persists get in touch with us.', 'woocommerce-store-toolkit' ); ?></p>
<?php
}
}
function woo_st_brand_data_meta_box( $term = '', $taxonomy = '' ) {
$term_taxonomy = 'product_brand';
$term_meta = get_term_meta( $term->term_id );
$type = 'brand';
$class = 'brand_data';
$template = 'term_data.php';
if ( file_exists( WOO_ST_PATH . 'templates/admin/' . $template ) ) {
include_once WOO_ST_PATH . 'templates/admin/' . $template;
} else {
$message = sprintf( __( 'We couldn\'t load the template file <code>%1$s</code> within <code>%2$s</code>, this file should be present.', 'woocommerce-store-toolkit' ), $template, WOO_ST_PATH . 'includes/admin/...' );
?>
<p><strong><?php echo wp_kses_data( $message ); ?></strong></p>
<p><?php _e( 'You can see this error for one of a few common reasons', 'woocommerce-store-toolkit' ); ?>:</p>
<ul class="ul-disc">
<li><?php _e( 'WordPress was unable to create this file when the Plugin was installed or updated', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin files have been recently changed and there has been a file conflict', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin file has been locked and cannot be opened by WordPress', 'woocommerce-store-toolkit' ); ?></li>
</ul>
<p><?php _e( 'Jump onto our website and download a fresh copy of this Plugin as it might be enough to fix this issue. If this persists get in touch with us.', 'woocommerce-store-toolkit' ); ?></p>
<?php
}
}
function woo_st_product_vendor_data_meta_box( $term = '', $taxonomy = '' ) {
$term_taxonomy = 'yith_shop_vendor';
$term_meta = get_term_meta( $term->term_id );
$type = 'product_vendor';
$template = 'post_data.php';
if ( file_exists( WOO_ST_PATH . 'templates/admin/' . $template ) ) {
include_once WOO_ST_PATH . 'templates/admin/' . $template;
} else {
$message = sprintf( __( 'We couldn\'t load the template file <code>%1$s</code> within <code>%2$s</code>, this file should be present.', 'woocommerce-store-toolkit' ), $template, WOO_ST_PATH . 'includes/admin/...' );
?>
<p><strong><?php echo wp_kses_data( $message ); ?></strong></p>
<p><?php _e( 'You can see this error for one of a few common reasons', 'woocommerce-store-toolkit' ); ?>:</p>
<ul class="ul-disc">
<li><?php _e( 'WordPress was unable to create this file when the Plugin was installed or updated', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin files have been recently changed and there has been a file conflict', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin file has been locked and cannot be opened by WordPress', 'woocommerce-store-toolkit' ); ?></li>
</ul>
<p><?php _e( 'Jump onto our website and download a fresh copy of this Plugin as it might be enough to fix this issue. If this persists get in touch with us.', 'woocommerce-store-toolkit' ); ?></p>
<?php
}
}
function woo_st_user_orders( $user ) {
if ( ! current_user_can( 'manage_woocommerce' ) ) {
return;
}
$user_id = $user->data->ID;
$posts_per_page = apply_filters( 'woo_st_user_orders_posts_per_page', 10 );
$args = array(
'numberposts' => $posts_per_page,
);
$total_orders = woo_st_get_user_orders( $user_id, $args, 'found_posts' );
$paged = ( isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1 );
if ( ! empty( $paged ) ) {
$args['paged'] = $paged;
}
$max_page = absint( $total_orders / $posts_per_page );
$orders = ( ! empty( $total_orders ) ? woo_st_get_user_orders( $user_id, $args ) : false );
$type = 'user';
$template = 'user_orders.php';
if ( file_exists( WOO_ST_PATH . 'templates/admin/' . $template ) ) {
include_once WOO_ST_PATH . 'templates/admin/' . $template;
} else {
$message = sprintf( __( 'We couldn\'t load the template file <code>%1$s</code> within <code>%2$s</code>, this file should be present.', 'woocommerce-store-toolkit' ), $template, WOO_ST_PATH . 'includes/admin/...' );
?>
<p><strong><?php echo wp_kses_data( $message ); ?></strong></p>
<p><?php _e( 'You can see this error for one of a few common reasons', 'woocommerce-store-toolkit' ); ?>:</p>
<ul class="ul-disc">
<li><?php _e( 'WordPress was unable to create this file when the Plugin was installed or updated', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin files have been recently changed and there has been a file conflict', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin file has been locked and cannot be opened by WordPress', 'woocommerce-store-toolkit' ); ?></li>
</ul>
<p><?php _e( 'Jump onto our website and download a fresh copy of this Plugin as it might be enough to fix this issue. If this persists get in touch with us.', 'woocommerce-store-toolkit' ); ?></p>
<?php
}
}
function woo_st_user_data_meta_box( $user = '' ) {
$user_id = $user->data->ID;
$user_meta = get_user_meta( $user_id );
$template = 'user_data.php';
if ( file_exists( WOO_ST_PATH . 'templates/admin/' . $template ) ) {
include_once WOO_ST_PATH . 'templates/admin/' . $template;
} else {
$message = sprintf( __( 'We couldn\'t load the template file <code>%1$s</code> within <code>%2$s</code>, this file should be present.', 'woocommerce-store-toolkit' ), $template, WOO_ST_PATH . 'includes/admin/...' );
?>
<p><strong><?php echo wp_kses_data( $message ); ?></strong></p>
<p><?php _e( 'You can see this error for one of a few common reasons', 'woocommerce-store-toolkit' ); ?>:</p>
<ul class="ul-disc">
<li><?php _e( 'WordPress was unable to create this file when the Plugin was installed or updated', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin files have been recently changed and there has been a file conflict', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin file has been locked and cannot be opened by WordPress', 'woocommerce-store-toolkit' ); ?></li>
</ul>
<p><?php _e( 'Jump onto our website and download a fresh copy of this Plugin as it might be enough to fix this issue. If this persists get in touch with us.', 'woocommerce-store-toolkit' ); ?></p>
<?php
}
}
function woo_st_scheduled_export_data_meta_box() {
global $post;
$post_id = absint( $post->ID ? $post->ID : false );
$post_meta = get_post_custom( $post_id );
$type = 'scheduled_export';
$template = 'post_data.php';
if ( file_exists( WOO_ST_PATH . 'templates/admin/' . $template ) ) {
include_once WOO_ST_PATH . 'templates/admin/' . $template;
} else {
$message = sprintf( __( 'We couldn\'t load the template file <code>%1$s</code> within <code>%2$s</code>, this file should be present.', 'woocommerce-store-toolkit' ), $template, WOO_ST_PATH . 'includes/admin/...' );
?>
<p><strong><?php echo wp_kses_data( $message ); ?></strong></p>
<p><?php _e( 'You can see this error for one of a few common reasons', 'woocommerce-store-toolkit' ); ?>:</p>
<ul class="ul-disc">
<li><?php _e( 'WordPress was unable to create this file when the Plugin was installed or updated', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin files have been recently changed and there has been a file conflict', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin file has been locked and cannot be opened by WordPress', 'woocommerce-store-toolkit' ); ?></li>
</ul>
<p><?php _e( 'Jump onto our website and download a fresh copy of this Plugin as it might be enough to fix this issue. If this persists get in touch with us.', 'woocommerce-store-toolkit' ); ?></p>
<?php
}
}
function woo_st_event_data_meta_box() {
global $post;
$post_id = absint( $post->ID ? $post->ID : false );
$post_meta = get_post_custom( $post_id );
$type = 'event';
$template = 'post_data.php';
if ( file_exists( WOO_ST_PATH . 'templates/admin/' . $template ) ) {
include_once WOO_ST_PATH . 'templates/admin/' . $template;
} else {
$message = sprintf( __( 'We couldn\'t load the template file <code>%1$s</code> within <code>%2$s</code>, this file should be present.', 'woocommerce-store-toolkit' ), $template, WOO_ST_PATH . 'includes/admin/...' );
?>
<p><strong><?php echo wp_kses_data( $message ); ?></strong></p>
<p><?php _e( 'You can see this error for one of a few common reasons', 'woocommerce-store-toolkit' ); ?>:</p>
<ul class="ul-disc">
<li><?php _e( 'WordPress was unable to create this file when the Plugin was installed or updated', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin files have been recently changed and there has been a file conflict', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin file has been locked and cannot be opened by WordPress', 'woocommerce-store-toolkit' ); ?></li>
</ul>
<p><?php _e( 'Jump onto our website and download a fresh copy of this Plugin as it might be enough to fix this issue. If this persists get in touch with us.', 'woocommerce-store-toolkit' ); ?></p>
<?php
}
}
function woo_st_booking_data_meta_box() {
global $post;
$post_id = absint( $post->ID ? $post->ID : false );
$post_meta = get_post_custom( $post_id );
$type = 'booking';
$template = 'post_data.php';
if ( file_exists( WOO_ST_PATH . 'templates/admin/' . $template ) ) {
include_once WOO_ST_PATH . 'templates/admin/' . $template;
} else {
$message = sprintf( __( 'We couldn\'t load the template file <code>%1$s</code> within <code>%2$s</code>, this file should be present.', 'woocommerce-store-toolkit' ), $template, WOO_ST_PATH . 'includes/admin/...' );
?>
<p><strong><?php echo wp_kses_data( $message ); ?></strong></p>
<p><?php _e( 'You can see this error for one of a few common reasons', 'woocommerce-store-toolkit' ); ?>:</p>
<ul class="ul-disc">
<li><?php _e( 'WordPress was unable to create this file when the Plugin was installed or updated', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin files have been recently changed and there has been a file conflict', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin file has been locked and cannot be opened by WordPress', 'woocommerce-store-toolkit' ); ?></li>
</ul>
<p><?php _e( 'Jump onto our website and download a fresh copy of this Plugin as it might be enough to fix this issue. If this persists get in touch with us.', 'woocommerce-store-toolkit' ); ?></p>
<?php
}
}
function woo_st_user_membership_data_meta_box() {
global $post;
$post_id = absint( $post->ID ? $post->ID : false );
$post_meta = get_post_custom( $post_id );
$type = 'user_membership';
$template = 'post_data.php';
if ( file_exists( WOO_ST_PATH . 'templates/admin/' . $template ) ) {
include_once WOO_ST_PATH . 'templates/admin/' . $template;
} else {
$message = sprintf( __( 'We couldn\'t load the template file <code>%1$s</code> within <code>%2$s</code>, this file should be present.', 'woocommerce-store-toolkit' ), $template, WOO_ST_PATH . 'includes/admin/...' );
?>
<p><strong><?php echo wp_kses_data( $message ); ?></strong></p>
<p><?php _e( 'You can see this error for one of a few common reasons', 'woocommerce-store-toolkit' ); ?>:</p>
<ul class="ul-disc">
<li><?php _e( 'WordPress was unable to create this file when the Plugin was installed or updated', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin files have been recently changed and there has been a file conflict', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin file has been locked and cannot be opened by WordPress', 'woocommerce-store-toolkit' ); ?></li>
</ul>
<p><?php _e( 'Jump onto our website and download a fresh copy of this Plugin as it might be enough to fix this issue. If this persists get in touch with us.', 'woocommerce-store-toolkit' ); ?></p>
<?php
}
}
function woo_st_generic_data_meta_box() {
global $post;
$post_id = absint( $post->ID ? $post->ID : false );
$post_meta = get_post_custom( $post_id );
$type = 'post';
$template = 'post_data.php';
if ( file_exists( WOO_ST_PATH . 'templates/admin/' . $template ) ) {
include_once WOO_ST_PATH . 'templates/admin/' . $template;
} else {
$message = sprintf( __( 'We couldn\'t load the template file <code>%1$s</code> within <code>%2$s</code>, this file should be present.', 'woocommerce-store-toolkit' ), $template, WOO_ST_PATH . 'includes/admin/...' );
?>
<p><strong><?php echo wp_kses_data( $message ); ?></strong></p>
<p><?php _e( 'You can see this error for one of a few common reasons', 'woocommerce-store-toolkit' ); ?>:</p>
<ul class="ul-disc">
<li><?php _e( 'WordPress was unable to create this file when the Plugin was installed or updated', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin files have been recently changed and there has been a file conflict', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin file has been locked and cannot be opened by WordPress', 'woocommerce-store-toolkit' ); ?></li>
</ul>
<p><?php _e( 'Jump onto our website and download a fresh copy of this Plugin as it might be enough to fix this issue. If this persists get in touch with us.', 'woocommerce-store-toolkit' ); ?></p>
<?php
}
}
function woo_st_membership_plan_data_meta_box() {
global $post;
$post_id = absint( $post->ID ? $post->ID : false );
$post_meta = get_post_custom( $post_id );
$type = 'membership_plan';
$template = 'post_data.php';
if ( file_exists( WOO_ST_PATH . 'templates/admin/' . $template ) ) {
include_once WOO_ST_PATH . 'templates/admin/' . $template;
} else {
$message = sprintf( __( 'We couldn\'t load the template file <code>%1$s</code> within <code>%2$s</code>, this file should be present.', 'woocommerce-store-toolkit' ), $template, WOO_ST_PATH . 'includes/admin/...' );
?>
<p><strong><?php echo wp_kses_data( $message ); ?></strong></p>
<p><?php _e( 'You can see this error for one of a few common reasons', 'woocommerce-store-toolkit' ); ?>:</p>
<ul class="ul-disc">
<li><?php _e( 'WordPress was unable to create this file when the Plugin was installed or updated', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin files have been recently changed and there has been a file conflict', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin file has been locked and cannot be opened by WordPress', 'woocommerce-store-toolkit' ); ?></li>
</ul>
<p><?php _e( 'Jump onto our website and download a fresh copy of this Plugin as it might be enough to fix this issue. If this persists get in touch with us.', 'woocommerce-store-toolkit' ); ?></p>
<?php
}
}
function woo_st_attachment_data_meta_box() {
global $post;
$post_id = absint( $post->ID ? $post->ID : false );
$post_meta = get_post_custom( $post_id );
$type = 'attachment';
$template = 'post_data.php';
if ( file_exists( WOO_ST_PATH . 'templates/admin/' . $template ) ) {
include_once WOO_ST_PATH . 'templates/admin/' . $template;
} else {
$message = sprintf( __( 'We couldn\'t load the template file <code>%1$s</code> within <code>%2$s</code>, this file should be present.', 'woocommerce-store-toolkit' ), $template, WOO_ST_PATH . 'includes/admin/...' );
?>
<p><strong><?php echo wp_kses_data( $message ); ?></strong></p>
<p><?php _e( 'You can see this error for one of a few common reasons', 'woocommerce-store-toolkit' ); ?>:</p>
<ul class="ul-disc">
<li><?php _e( 'WordPress was unable to create this file when the Plugin was installed or updated', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin files have been recently changed and there has been a file conflict', 'woocommerce-store-toolkit' ); ?></li>
<li><?php _e( 'The Plugin file has been locked and cannot be opened by WordPress', 'woocommerce-store-toolkit' ); ?></li>
</ul>
<p><?php _e( 'Jump onto our website and download a fresh copy of this Plugin as it might be enough to fix this issue. If this persists get in touch with us.', 'woocommerce-store-toolkit' ); ?></p>
<?php
}
}
order_item_data_hpos.php
<?php
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! empty( $order_items ) ) : ?>
<table class="widefat striped" style="font-family:monospace; text-align:left; width:100%;">
<tbody>
<p> <?= "Type: " . $type ?> </p>
<?php
foreach ( $order_items as $order_item ) :
$data = $order_item->get_data();
foreach ( $data as $key => $value ) :
if ( 'meta_data' === $key ) :
foreach ( $value as $meta ) :
?>
<tr>
<th style="width:20%;"><?php echo 'meta_data[' . esc_html( $meta->get_data()['key'] ) . ']'; ?></th>
<td>
<?php
$value = $meta->get_data()['value'];
switch ( $value ) {
case is_array( $value ):
echo '<pre>' . esc_html( print_r( $value, true ) ) . '</pre>';
break;
case is_object( $value ):
echo '<pre>' . esc_html( print_r( $value, true ) ) . '</pre>';
break;
default:
echo esc_html( $value );
break;
}
?>
</td>
</tr>
<?php
endforeach;
else :
?>
<tr>
<th style="width:20%;"><?php echo esc_html( $key ); ?></th>
<td>
<?php
switch ( $value ) {
case is_array( $value ):
echo '<pre>' . esc_html( print_r( $value, true ) ) . '</pre>';
break;
case is_object( $value ):
echo '<pre>' . esc_html( print_r( $value, true ) ) . '</pre>';
break;
default:
echo esc_html( $value );
break;
}
?>
</td>
</tr>
<?php
endif;
endforeach;
endforeach;
?>
</tbody>
</table>
<?php else : ?>
<p><?= "No order item data is associated with type: " . $type ?></p>
<?php endif; ?>