In WooCommerce habe ich perfekte Marken für das WooCommerce -Plugin ermöglicht, Produktmarken anzuzeigen. Ich möchte, dass die Marke während des gesamten Zyklus vor dem Produktnamen erscheint (einzelne Produktseite, Karren, Checkout, Mini -Karren, Bestellung und E -Mails).
Ich kann die zugehörige Marke vor dem Produktnamen in Karren und den Kasse mit "Hinzufügen von WooCommerce-Markennamen zu CART-Artikel-Produktnamen" Antwortcode leicht geändert (mit PBW-Brand benutzerdefinierte Taxonomie) , anzeigen.// Display product brand in Cart and checkout pages
add_filter( 'woocommerce_cart_item_name', 'customizing_cart_item_name', 10, 3 );
function customizing_cart_item_name( $product_name, $cart_item, $cart_item_key ) {
$product = $cart_item['data']; // The product
$product_id = $cart_item['product_id']; // The product id
// Loop through the product brand names
foreach( wp_get_post_terms( $product_id, 'pwb-brand' ) as $wp_term )
$brand_names[] = $wp_term->name; // Set the brand names in an array
$brand_names_str = implode( ', ', $brand_names); // Set the brand names in a comma separated string array
$brand = $brand_names_str;
$product_permalink = $product->get_permalink( $cart_item );
if ( is_cart() && count( $brand_names ) > 0 )
return sprintf( '%s %s', esc_url( $product_permalink ), $brand, $product->get_name() );
elseif ( count( $brand_names ) > 0 )
return $brand . ' ' . $product_name;
else return $product_name;
}
< /code>
Aber ich weiß nicht, wie ich das für die Bestell- und E -Mail -Benachrichtigungen implementieren soll. < /p>
Stellen Sie die Produktmarke und den Namen der Produktmarke in WooCommerce -Bestellungen und E -Mail -Benachrichtigungen ⇐ Php
-
- Similar Topics
- Replies
- Views
- Last post