Created
August 6, 2014 22:50
-
-
Save alisonmf/aec9a982f854c0754a34 to your computer and use it in GitHub Desktop.
Remove price label from gravity form product field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( is_page('slug') ) { // only executes on this page ?> | |
<script type="text/javascript"> | |
function gform_format_option_label(fullLabel, fieldLabel, priceLabel, selectedPrice, price, formId, fieldId) | |
{ | |
// Only for field with ID of 5 | |
if (fieldId == 5) | |
// Disable option pricing. Simply return the field label. | |
// This removes the price differentials in the drop down | |
return fieldLabel; | |
} | |
</script> | |
<?php } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm actually looking to do something similar, and wonder if you could shed some light, as I've never used the gform_format_option_label bit before. I have a Single Product field that I'm using as a conditional discount (i.e. if you register before X date, save $25). But I'd love to have the "Price" label become "Discount" if the number is below zero. Thoughts?
Much thanks
CT
... Later that day ...
Add the following filter to your theme's functions.php file:
The _13 added to the gform_product_price specifies the form id. The _133 specifies the field id, on form #13. I named my function set_price_label_1 because I was going to add another filter for fields 135, 136, 137. Perhaps there's an easier way to specify all four fields in the same filter, but I tried a couple and didn't find it and this is such a minor aspect having 4 wasn't a big deal.