My account

Create an Account

Sign In

Add to cart
get_sku(); $product_type = $product->get_type(); $product_id = $product->get_id(); if ($product_type === 'variation') { $product_id = $product->get_parent_id(); } $lot_expiry_date = get_field('lot_expiry_date', $product_id); $saved_order_lots = get_post_meta(get_the_ID(), 'order_lots', true); if ($lot_expiry_date) { echo '

Lot & Expiry Date

'; $saved_lot_expiry_date = get_post_meta($item->get_order_id(), 'order_lots', true); echo ''; } else { $saved_lot = isset($saved_order_lots[$product_sku]['lot']) ? $saved_order_lots[$product_sku]['lot'] : ''; $saved_expiry_date = isset($saved_order_lots[$product_sku]['expiry_date']) ? $saved_order_lots[$product_sku]['expiry_date'] : ''; echo ''; echo ''; } } add_action('woocommerce_process_shop_order_meta', 'save_order_lot_expiry_dates_meta', 10, 2); function save_order_lot_expiry_dates_meta($order_id, $post) { if (isset($_POST['order_lot_expiry_dates'])) { $order_lots = $_POST['order_lot_expiry_dates']; update_post_meta($order_id, 'order_lots', $order_lots); $shipstation_order_lot_one = ''; $shipstation_order_lot_two = ''; $index = 0; foreach ($order_lots as $sku => $lot) { // $lot_info = $sku; $lot_info = ''; if (is_array($lot)) { // $lot_info .= ' | ' . $lot['lot']; $lot_info .= $lot['lot']; } else { // $lot_info .= ' | ' . $lot; $lot_info .= $lot; } if ($index < count($order_lots) - 1) { $lot_info .= ' -/- '; } $index++; if ((strlen($shipstation_order_lot_one) + strlen($lot_info)) < 100) { $shipstation_order_lot_one .= $lot_info; } else { $shipstation_order_lot_two .= $lot_info; } } update_post_meta($order_id, 'shipstation_order_lot_one', $shipstation_order_lot_one); update_post_meta($order_id, 'shipstation_order_lot_two', $shipstation_order_lot_two); } } // ============== // ============== // ============== // ============== // ============== // ============== // ============== // ============== // ============== // ============== Customer notes // ============== // ============== // ============== // ============== // ============== // ============== // Hook into the 'add_meta_boxes' action add_action('add_meta_boxes', 'add_custom_order_meta_box'); function add_custom_order_meta_box() { // Add your metabox add_meta_box( 'custom-order-meta-box', // Unique ID for the metabox __('Internal Information', 'textdomain'), // Metabox title 'display_custom_order_meta_box', // Callback function to display the content 'shop_order', // Post type where the metabox should appear 'side', // Context: 'normal', 'side', or 'advanced' 'high' // Priority: 'default', 'high', 'low' ); } // Callback function to display the content of the metabox function display_custom_order_meta_box($post) { // Retrieve existing meta data $order = wc_get_order($post->ID); $signature = get_post_meta($post->ID, 'shipping_signature_required', true); echo ''; ?>

Signature Option