By using Elementorforum.com’s services you agree to our Cookies Use and Data Transfer outside the EU.
We and our partners operate globally and use cookies, including for analytics, personalisation, ads and Newsletters.

  • Join the Best Wordpress and Elementor Support forum

    Provide or get advice on everything Elementor and Wordpress, ask questions, gain confirmation or just become apart of a friendly, like minded community who love Wordpress and Elementor


    Join us!

Woocommerce Product Title

K

kbrown101213

New Member
Hello everyone! First post and beginner!! Our products are perfect for the attributes with having different brand names, colors, and finishes. That being said if I listed Brand + Color + Finish as a product name it would be too long. So I have been listing just the color name on the shop page.

My question is - Within using Elementor or with another plug-in - Is there a way to add an attribute to the SINGLE product page name?
i.e. if the product was called WHITE, and I had two attributes (brand was ABC and finish was 123) - I want the shop page to just say "WHITE", but I want the single product page to say "ABC WHITE 123"

Is this possible?
 
Community

Community

Administrator
Staff member
Yeah it's possible with some custom functions, this function would create what you need. Then instead of using the default page title in a single product template. You would simply use shortcode :
Rich (BB code):
[custom_product_title]
PHP:
function custom_product_title_with_attributes(){global $product;
    $brand = $product->get_attribute('pa_brand');
    $finish = $product->get_attribute('pa_finish');
    $title = $product->get_title();
    return $brand . ' ' . $title . ' ' . $finish;
}
add_shortcode('custom_product_title', 'custom_product_title_with_attributes');
 
K

kbrown101213

New Member
Thank you for your help, it is not working and I am sure it is a user error as I am new to custom coding. I put the code PHP in Elementor>Custom Code. I did get an error on lines 2-4 for the ">" so I removed that but it did not work. Did I put it in the wrong spot or do I need to put the Rich BB Code somewhere?
 
Elementor Services Elementor Services

Latest posts

Latest Resources

Other Elementor Resources

elementor official
Top