# Show Option Price instead of Variable Pricing

**URL:** <https://community.gravityforms.com/t/show-option-price-instead-of-variable-pricing/15374>\
**Category:** Get Help\
**Tags:** gform\_format\_option\_label, options\
**Created:** [June 19, 2023, 2:38pm UTC](https://community.gravityforms.com/t/show-option-price-instead-of-variable-pricing/15374 "2023-06-19T14:38:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![user62f2bc2ca064b187](https://avatars.discourse-cdn.com/v4/letter/u/8dc957/32.png) [@user62f2bc2ca064b187](https://community.gravityforms.com/u/user62f2bc2ca064b187)\
**Post date:** [June 19, 2023, 2:38pm UTC](https://community.gravityforms.com/t/show-option-price-instead-of-variable-pricing/15374/1 "2023-06-19T14:38:31Z")

</div>

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!

 ![gform_pricing](https://us1.discourse-cdn.com/flex020/uploads/gravityforms1/original/2X/2/2032b34dede29c9b482523250b2ea009aed8de72.png)

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [June 20, 2023, 6:12pm UTC](https://community.gravityforms.com/t/show-option-price-instead-of-variable-pricing/15374/2 "2023-06-20T18:12:44Z")

</div>

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

```auto
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`:

```auto
<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;
}

</script>

```

---

<div class="post-metadata">

**Author:** ![user62f2bc2ca064b187](https://avatars.discourse-cdn.com/v4/letter/u/8dc957/32.png) [@user62f2bc2ca064b187](https://community.gravityforms.com/u/user62f2bc2ca064b187)\
**Post date:** [June 23, 2023, 2:24pm UTC](https://community.gravityforms.com/t/show-option-price-instead-of-variable-pricing/15374/3 "2023-06-23T14:24:39Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/gravityforms1/original/2X/f/fef63f0599c45e0218c30d9f5d7ca8bff9b00189.png) [@system](https://community.gravityforms.com/u/system)\
**Post date:** [July 23, 2023, 2:24pm UTC](https://community.gravityforms.com/t/show-option-price-instead-of-variable-pricing/15374/4 "2023-07-23T14:24:50Z")

</div>

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