在Woocommerce中将产品下拉列表选定值添加为购物车项目元数据

Based on "Add dropdown to products and display the value on Woocommerce cart" answer code, I'm trying to add an attribute value from a dropdown to the cart item meta data, but I don't know yet how.

<select id ="id_dropdown_one_end" name="dropdown_one_end">
    <option value_one_end="0">Ingenting</option>
    <option value_one_end="250">Øye       250,-</option>
    <option value_one_end="350">Sjakkel   350,-</option>
    <option value_one_end="400">Spleis    400,-</option>
</select>

If value_one_end attribute was named just value instead (as by default), I could get the selected value with PHP using:

$cart_item_data['price_one_end'] = esc_attr($_POST['dropdown_one_end']);

But by not having a value attribute the above statement gets the name of the option instead ('Ingenting'), which is what I want.

But how do I use php to get an attribute called something else than value? I have tried something like this:

$cart_item_data['price_one_end'] = esc_attr($_POST['dropdown_one_end'].attr('value_one_end'));

But it doesn't work.

Any ideas?