Support

Account

Home Forums General Issues woocommerce ordem item

Helping

woocommerce ordem item

  • Hi, I need some help to display some values item in the order view.

    I add two custom fields on the product detail page (Bank Name & Account number)
    That field is just for the editors, I’m not showing that in the frontend.

    But what I need is to show that values in my order details page in the admin.

    Is there a way to do that?

    At the moment I found that but I don’t get any value

    function add_cart_item_data( $cart_item_data, $product_id ) {
        $cart_item_data[ "meta1" ] = $_POST["bank_name"];
        $cart_item_data[ "meta2"] = $_POST["bank_number"];
        return $cart_item_data;
    }
    add_filter( 'woocommerce_add_cart_item_data', 'add_cart_item_data', 10, 2 );
    
    function adding_custom_data_in_order_items_meta( $item_id, $values, $cart_item_key ) {
    
            $the_meta = $values['meta1'] . '.' .  $values['meta2'];
            wc_add_order_item_meta($item_id, 'pa-the-meta', $the_meta );
    
    }
    add_action('woocommerce_add_order_item_meta','adding_custom_data_in_order_items_meta', 10, 3 );
  • Hi @jdaquila

    Thanks for the post.

    You can get ACF values from the $_POST data in the PRO version like so:

    $value = $_POST['acf']['field_xxxxxxx'];
    
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘woocommerce ordem item’ is closed to new replies.