Skip to content

Instantly share code, notes, and snippets.

@plugin-republic
Created October 17, 2025 14:22
Show Gist options
  • Select an option

  • Save plugin-republic/b1d66f0dab09b4c60cbd84e32019b3c8 to your computer and use it in GitHub Desktop.

Select an option

Save plugin-republic/b1d66f0dab09b4c60cbd84e32019b3c8 to your computer and use it in GitHub Desktop.
<?php
/**
* Display the value of a specific field as a price
* Update the field_id to match your own field ID
*/
function demo_display_value_as_price( $value, $item ) {
if( $item['field_id'] == '1047' && $item['type'] == 'number' ) {
$value = wc_price( $value );
}
return $value;
}
add_filter( 'pewc_filter_item_value_in_cart', 'demo_display_value_as_price', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment