If the code you provided is not working for other themes, it’s possible that the hooks or actions used by those themes are different. To remove product categories from the single product page using PHP, you can try the following code:
function remove_product_meta() {
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );
}
add_action( 'init', 'remove_product_meta' );
This code attempts to remove product metadata (which includes categories) on a single product page. The init action is used to ensure that the function is added early enough in the WordPress loading process.
If this still doesn’t work, it is recommended to check the documentation of the theme you are using to find the correct action hook to remove the product meta. Themes can have different structures and it is important to find the right hooks to modify certain parts of the page. You should refer to the theme’s documentation or contact the theme’s support for assistance.