Hi,
The code
if(!empty($product_description)){
$doc->setMetadata('description', $productname only $price);
}
is unfortunately incorrect, it is not a valid PHP code so I think it generates you fatal errors.
So I recommend you to use some like :
$doc->setMetadata('description', $product_name . ' - ');
If you want to generate a string with variables, you need to "concat" them.
Such kind of modification requires some PHP/Development skills and if you want to add a price in the meta description, it will require a more complexe modification.
Regards,