I'm totally new to WordPress and WooCommerce, so apologies for the poor explanation.
I have this code:
$text = apply_filters( 'prefix_xml_feeds_productname_variant', $text, $product_item->ID, $vars->ID );
And need to display $vars->ID in my function:
So I got:
function custom_product_name() {
global $product;
$product_name = $product->get_name();
$sku = $product->get_sku();
$text = 'Example.com ' . $sku . ' ' . $product_name . ' ' . $vars->ID;
return $text;
}
add_filter( 'prefix_xml_feeds_productname_variant', 'custom_product_name' );
How can I access $vars variable value in my callback function?