0
votes

I use WooCommerce with the plugin "YITH Request a quote" to enable requests for quotations.

What I try

I would like to create custom meta data when the User is requesting a quote.

I try to do this with the following hook:

add_action('woocommerce_checkout_create_order', 'before_checkout_create_order', 20, 2);
function before_checkout_create_order( $order, $data ) {
    $order->update_meta_data( '_custom_meta_key', 'value' );
}

... unfortunately without success. Enclosed you will find a picture of the meta-information I mean.

Do you have an idea? :-)

1

1 Answers

0
votes

This was the solution:

add_action('woocommerce_new_order_item','add_basic_meta_for_new_quote',10,3); // add extra order metas

function add_basic_meta_for_new_quote($item_id, $values, $cart_item_key)
{
    wc_add_order_item_meta($item_id, 'key', 'value');
}