How can I set a custom price based on user input? This custom price is hard coded. Any suggestions? Something like function add_custom_price( $cart_object, $custom_price )
<code>add_action( 'woocommerce_before_calculate_totals', 'add_custom_price' );
function add_custom_price( $cart_object,$custom_price ) {
$custom_price = $variable_from_input; // This will be my custom input variable
foreach ( $cart_object->cart_contents as $key => $value ) {
$value['data']->price = $custom_price;
}
}</code>