• Hi
    This is not working, as i have just print Hello text but not working.

    add_action( 'woocommerce_checkout_create_order_line_item', hi_add_order_item_meta', 10, 4 );
    
    function hi_add_order_item_meta( $item, $cart_item_key, $values, $order ) {
    
    echo 'helllo';
    
    }

    Thanks
    LR

Viewing 1 replies (of 1 total)
  • Thread Starter LogicRays Technologies

    (@logicrays)

    Use below function.

    function custom_meta_after_order_itemmeta( $item_id, $item, $product) {

    $product_id = $item[‘product_id’];
    if( $item->is_type( ‘line_item’ ) ){
    $start = get_post_meta( $product_id, ‘wbc_cal_start’, true );
    echo ‘Start Date: ‘ .date(‘d-m-Y’, strtotime($start));
    echo ‘<br>’;
    $end = get_post_meta( $product_id, ‘wbc_cal_end’, true );
    echo ‘End date: ‘ .date(‘d-m-Y’, strtotime($end));
    }
    };

    // add the action
    add_action( ‘woocommerce_after_order_itemmeta’, ‘custom_meta_after_order_itemmeta’, 10, 3);

Viewing 1 replies (of 1 total)
  • The topic ‘Order line meta action not working at all’ is closed to new replies.