Skip to content

Instantly share code, notes, and snippets.

@victormattosvm
Last active December 1, 2021 14:31
Show Gist options
  • Save victormattosvm/33ddf57afc0f49c49236b31e196232ad to your computer and use it in GitHub Desktop.
Save victormattosvm/33ddf57afc0f49c49236b31e196232ad to your computer and use it in GitHub Desktop.
<?php
/**
* This filter was added in file 'includes/tools/XML/XMLProductFeed.php' (LINE 298)
* It allows any user to add custom params to the feed generation.
*/
add_filter('product_feed_params', function ( $params, $product, $parent_product ){
if( $parent_product ){
$product_id = $parent_product->get_id();
}else{
$product_id = $product->get_id();
}
$vendor = \get_wcmp_product_vendors($product_id);
if( $vendor ){
$params[] = array(
'name' => __( 'Seller' ),
'value' => $vendor->user_data->display_name
);
}
return $params;
}, 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment