Hallo!
Ich würde gerne ein Produkt, dass von einer AWIN API importiert wird automatisch einer Produktkategorie hinzufügen, wenn im Produkttitel das Wort "Insert" vorkommt.
Das habe ich (leider ohne wirkliche Programmierkenntnisse) verbrochen und noch nicht getestet, da ich zuerst fragen wollte, ob es so evtl. stimmt:
Code
function atkp_modify_product_awin_callback( $product, $filterdata ) {
$productName = $filterdata['product_name'] ;
$categoryName = 'Insert';
if(strpos($productName, $categoryName) !== false){
$productCATEGORY = 'Insert';
}
$product->category_name = $productCATEGORY;
return $product;
}
add_filter( 'atkp_modify_product_awin', 'atkp_modify_product_awin_callback', 10,2);
Display More
Stimmt das in etwa, oder muss ich etwas ausbessern?
Danke und lg
Günther