Skip to content

Instantly share code, notes, and snippets.

@plugin-republic
Created November 6, 2025 13:32
Show Gist options
  • Select an option

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

Select an option

Save plugin-republic/ee4dbdcc0687a103ba88f312447f681b to your computer and use it in GitHub Desktop.
<?php
/**
* Change the product name for a child product
*/
function demo_change_child_product_title( $title, $child_product ) {
if( ! is_object( $child_product ) || is_wp_error( $child_product ) ) {
return $title;
}
if( $child_product->get_id() == 1234 ) { // Update your child product ID here
$title = 'New name here'; // Change your new text here
}
return $title;
}
add_filter( 'pewc_child_product_title', 'demo_change_child_product_title', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment