Title: redfoxbuilders's Replies | WordPress.org

---

# redfoxbuilders

  [  ](https://wordpress.org/support/users/redfoxbuilders/)

 *   [Profile](https://wordpress.org/support/users/redfoxbuilders/)
 *   [Topics Started](https://wordpress.org/support/users/redfoxbuilders/topics/)
 *   [Replies Created](https://wordpress.org/support/users/redfoxbuilders/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/redfoxbuilders/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/redfoxbuilders/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/redfoxbuilders/engagements/)
 *   [Favorites](https://wordpress.org/support/users/redfoxbuilders/favorites/)

 Search replies:

## Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Calculated Fields Form - AI Form Builder for WordPress - Contact, Payment, Quote, Quiz & More] Total Price Estimate Based on Drop Downs and Multiple Selects](https://wordpress.org/support/topic/total-price-estimate-based-on-drop-downs-and-multiple-selects/)
 *  Thread Starter [redfoxbuilders](https://wordpress.org/support/users/redfoxbuilders/)
 * (@redfoxbuilders)
 * [2 years ago](https://wordpress.org/support/topic/total-price-estimate-based-on-drop-downs-and-multiple-selects/#post-17889046)
 * Hello [@codepeople](https://wordpress.org/support/users/codepeople/)
 * Thank you for the great feedback, your coding definitley makes it easier to run.
   We had to code it the original way to handle the complex scenarios where ceilings
   and skirting boards can be selected either with or without room selections, to
   make sure the costs are calculated correctly. Since almost all rooms in the UK
   usually have skirting boards we had to times it by bedrooms, bathrooms, and the
   other areas of the property. However there is also the option that if a customer
   just wants to have their ceilings painted only and also only have their skirting
   boards painted they can chooses those options.
 * So the original drop down bedrooms, bathrooms, other rooms of the property only
   include prices for walls making it easier to split the cost calculator for other
   types of painting.
 * Our code also includes parsing to handle undefined or zero values, logging for
   easier debugging, specific adjustments for bedroom costs, and iterative calculations
   for dynamic pricing based on selected options. These features make sure the costs
   are calculated accurately and allows some flexibility
 * Please check the final build here, we are still working out the kinks
 * [Instant Price Calculator Residential Painting and Decorating (redfoxbuilders.co.uk)](https://www.redfoxbuilders.co.uk/residential-painting-decorating/)
 * Your plugin is amazing and I can’t wait to spread it to more people!!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Calculated Fields Form - AI Form Builder for WordPress - Contact, Payment, Quote, Quiz & More] Total Price Estimate Based on Drop Downs and Multiple Selects](https://wordpress.org/support/topic/total-price-estimate-based-on-drop-downs-and-multiple-selects/)
 *  Thread Starter [redfoxbuilders](https://wordpress.org/support/users/redfoxbuilders/)
 * (@redfoxbuilders)
 * [2 years ago](https://wordpress.org/support/topic/total-price-estimate-based-on-drop-downs-and-multiple-selects/#post-17888171)
 * Thank you Author!
 * Okay I got it working except for one last thing. Still fixing a few issues
 * This is the final code after hours trying to get it to work. So if anyone wants
   to use it for calculating trade work, they can.
 *     ```wp-block-code
       (function(){var baseAmount = 250;var totalPrice = baseAmount;// Get field values directly by their names and parse as neededvar bedrooms = parseFloat(fieldname16|v) || 0;var bathrooms = parseFloat(fieldname47|v) || 0;var propertyType = parseFloat(fieldname18|v) || 0;var occupied = parseFloat(fieldname17|v) || 0;var additionalRooms = fieldname20|v || [];var extraPainting = fieldname21|v || [];var doors = parseInt(fieldname25|v) || 0;var windows = parseInt(fieldname29|v) || 0;var repairs = parseFloat(fieldname22|v) || 0;var congestionZone = parseFloat(fieldname44|v) || 0;var parkingAvailable = parseFloat(fieldname45|v) || 0;// Adjust bedroom costvar bedroomCost = 0;if (bedrooms == 300) {    bedroomCost = 180;} else {    bedroomCost = bedrooms;}// Log field values to the consoleconsole.log("Bedrooms: ", bedroomCost);console.log("Bathrooms: ", bathrooms);console.log("Property Type: ", propertyType);console.log("Occupied: ", occupied);console.log("Additional Rooms: ", additionalRooms);console.log("Extra Painting: ", extraPainting);console.log("Doors: ", doors);console.log("Windows: ", windows);console.log("Repairs: ", repairs);console.log("Congestion Zone: ", congestionZone);console.log("Parking Available: ", parkingAvailable);/* Calculate bedrooms cost */totalPrice += bedroomCost;/* Calculate bathrooms cost */totalPrice += bathrooms;/* Calculate property type cost */totalPrice += propertyType;/* Calculate occupied cost */totalPrice += occupied;/* Calculate additional rooms cost */if (additionalRooms.length > 0) {    for (var i = 0; i < additionalRooms.length; i++) {        totalPrice += parseFloat(additionalRooms[i]) || 0;    }}/* Calculate extra painting cost */var numBedrooms = bedroomCost ? 1 : 0;var numBathrooms = bathrooms ? 1 : 0;var numAdditionalRooms = additionalRooms.length;var totalRooms = numBedrooms + numBathrooms + numAdditionalRooms;// Adjust for ceiling and skirting board if no other rooms are selectedif (totalRooms === 0 && extraPainting.length > 0) {    if (extraPainting.includes("80")) totalRooms += 1;    if (extraPainting.includes("40")) totalRooms += 1;}var ceilingCost = 80 * totalRooms;var skirtingBoardCost = 40 * totalRooms;if (extraPainting.length > 0) {    for (var j = 0; j < extraPainting.length; j++) {        if (extraPainting[j] == "80") {            totalPrice += ceilingCost;        } else if (extraPainting[j] == "40") {            totalPrice += skirtingBoardCost;        }    }}/* Calculate doors cost */totalPrice += 45 * doors;/* Calculate windows cost */totalPrice += 35 * windows;/* Calculate repairs cost */totalPrice += repairs;/* Calculate congestion zone cost */totalPrice += congestionZone;/* Calculate parking available cost */totalPrice += parkingAvailable;// Log the final total priceconsole.log("Total Price: ", totalPrice);return totalPrice;})()
       ```
   
 * How do I hide the numbers/hashtags symbols under phone number? I can’t seem to
   hide it without messing up that field. At the moment am using website phone number
   its not ideal
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Calculated Fields Form - AI Form Builder for WordPress - Contact, Payment, Quote, Quiz & More] Total Price Estimate Based on Drop Downs and Multiple Selects](https://wordpress.org/support/topic/total-price-estimate-based-on-drop-downs-and-multiple-selects/)
 *  Thread Starter [redfoxbuilders](https://wordpress.org/support/users/redfoxbuilders/)
 * (@redfoxbuilders)
 * [2 years ago](https://wordpress.org/support/topic/total-price-estimate-based-on-drop-downs-and-multiple-selects/#post-17887811)
 * Thank you let me try that

Viewing 3 replies - 1 through 3 (of 3 total)