Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1283381

    Hey dear support Team,
    I’d like to know how I could manage to plave the brand name of a product an it’s associated brand in front of the product name in the title?
    I tried this code (and several other versions of it) in the functions.php but it didn’t worked:

    add_action( 'woocommerce_shop_loop_item_title', 'aq_display_brand_before_title', 16 );
     function aq_display_brand_before_title(){
       global $product;
       $product_id = $product->get_id();
         $product_excerpt = $product->post->post_excerpt;
       $brands = wp_get_post_terms( $product_id, 'pwb-brand' );
       foreach( $brands as $brand ) echo '<div class="brand_stie"><span>brands: </span><a href="'.get_term_link($brand->term_id).'">'.$brand->name.'</a></div>';
     }

    Could you please help me with that?
    All the best and stay healthy,
    Chris

    #1285243

    Hey Chris,

    I’m very sorry for the late reply. Maybe you could use one of these hooks? https://www.businessbloomer.com/woocommerce-visual-hook-guide-single-product-page/

    Best regards,
    Rikard

    #1288326

    Hey Rikard,
    first of all, thank you for your help.
    I realized that I didn’t descripted my task pretty well. So I try to make it better, so that you and your mates here at Kriesi can assist me maybe.
    What I want rto do is a basic SEO move in the onlineshop optimization (btw. … I write concepts for advanced seo for arround 21 years now – so if you guys need any hint regarding seo, feel free to contact me).

    This is, what I want to create (Web-Development isn’t my disciplin):
    1. I would like to have the Brandname which is associated to the product to be placed in front of the product title in any place the product title is mentioned.
    2. Data fields seperated offers a view more options doing nice stuff with them, but here I would like to place it like this:
    Regular Product title h1 in single product page: [h1]product-name[/h1]
    The target: [h1]brand-name produkt-name[/h1]
    A different place would be the category view, with the same target as well as the cart and so on.

    Could you please assist me with a function tweak or any other working solution?

    Thanks in advance for your help and time.
    Stay healthy,
    Chris

    #1288630

    May I push this once so maybe anyone already solved this issue and would share the solution with me and others?
    Temporally I solved it by importing with WP All Import Pro and added the brand in front of the product name. It would be really nice to have the other way in mind.

    #1289298

    Hi Chris,

    Sorry for the late reply. If you can’t get it working with the available hooks, then a solution for that would be out of scope of theme support unfortunately.

    I’m not sure how you solved it temporarily, but if that is working, then I would suggest that you go with that solution for now.

    Best regards,
    Rikard

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.