Show Option Price instead of Variable Pricing

I’m having a hard time understanding how to implement this javascript code. I’d like to have the +/- pricing at the end of the item NOT appear. I know I need to add the javascript code to an html block on a page, but it’s not working for me. I’m not a coder, so I’m not sure how to implement this properly - I’ve added the script and put all the field numbers in that I need to have the pricing disappear on – it just doesn’t look right… help!

Hi Matt. When you add in all the field IDs like that, you are saying:

IF fieldID IS NOT "28, 51, 47, 67, 73, etc"

That long string is never going to match a field ID. 73 (for example), does not match the long string “28, 51, 47, 67, 73, etc”.

Try code like this instead to check if the fieldId matches any of the fieldIds in an array targetFieldIds:

<script type="text/javascript">

function gform_format_option_label(fullLabel, fieldLabel, priceLabel, selectedPrice, price, formId, fieldId) {
    var targetFieldIds = [28, 51, 47, 67, 73, 63, 64, 31, 75, 76, 77]; // double check these field IDs
    if (!targetFieldIds.includes(fieldId)) {
        return fullLabel;
    priceLabel = " <span class='ginput_price'>" + gformFormatMoney(price) + '</span>';
    return fieldLabel + priceLabel;


Thanks for the updated script! I have a friend helping me now too, and he said for some reason the site isn’t actually pulling the function. So the script works, but the function isn’t been executed. I’ll post here in a day or so when he sorts it out in case this happens to anyone else!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.