function calculate_custom_text_fee( $cart_object ) {
foreach ( $cart_object->get_cart() as $cart_item ) {
// get the custom pricing for this product
$pricing_custom = get_post_meta( $cart_item['product_id'], '_number_field_1', true );
// get product price
$price = floatval( $cart_item['data']->get_price() );
// set new price
$cart_item['data']->set_price( $price + $pricing_custom );
}
}
add_action( 'woocommerce_before_calculate_totals', 'calculate_custom_text_fee', 99, 1 );
But How can we ensure through the coding that only when the checkbox is ticked should this give a +ve quantity else 0→
$pricing_custom = get_post_meta( $cart_item['product_id'], '_number_field_1', true );