Extract a word from “Product Variation”
-
Hi there,
I would like to extract only the word “Laura” from a string of the category Product Variation, namely the one after the text: (PFLICHTFELD):
I have tried this but with no luck ??
add_filter('woe_fetch_item_meta', function($value, $meta, $item, $product) {
if (isset($value['Product Variation'])) {
$product_variation = $value['Product Variation'];
$pattern = '/Name eingeben \(PFLICHTFELD\): ([^0-9]+)/';
if (preg_match($pattern, $product_variation, $matches)) {
$value['Product Variation'] = trim($matches[1]);
}
}
return $value;
}, 10, 4);The whole string looks like this:
GR??E: M | Name eingeben (PFLICHTFELD): Laura 0,00 €
Thank you very much for your time otherwise no worries!
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- You must be logged in to reply to this topic.