Skip to content

Instantly share code, notes, and snippets.

@plugin-republic
Created February 9, 2021 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plugin-republic/bcb329324e9a1c7545d02cd6a599b635 to your computer and use it in GitHub Desktop.
Save plugin-republic/bcb329324e9a1c7545d02cd6a599b635 to your computer and use it in GitHub Desktop.
<?php
/**
* Display child products as meta in parent product
*/
add_filter( 'pewc_display_child_product_meta', '__return_true' );
/**
* Add the group name to fields
*/
function prefix_add_group_to_field_name( $value, $field ) {
if( isset( $field['group_id'] ) ) {
$group_name = get_the_title( $field['group_id'] );
$value .= ' - ' . $group_name . ' [#' . $field['group_id'] . ']';
}
return $value;
}
add_filter( 'pewc_filter_item_value_in_cart', 'prefix_add_group_to_field_name', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment