Last active
January 23, 2024 04:29
-
-
Save webtoffee-git/58871f861469f3518bf689a39fe91c4d to your computer and use it in GitHub Desktop.
Generate product description for non english products - By WebToffee ( Product Import Export plugin )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php //Do not copy this line of code | |
function alter_product_description_content($messages, $data) { | |
// Check the language you want to generate the description in | |
$target_language = 'Spanish'; // Change this to the desired language | |
foreach ($messages as &$message) { | |
if ($message['role'] === 'user') { | |
$message['content'] = "Write a product description in $target_language with $tone tone, based on the following features: '{$data['product_description']}'."; | |
} | |
} | |
return $messages; | |
} | |
add_filter('wt_chatgpt_product_description_request', 'alter_product_description_content', 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment