[Resolved] inserted pa_attribute after woo product title, how to assign a class for styling

Home Forums Support [Resolved] inserted pa_attribute after woo product title, how to assign a class for styling

Home Forums Support inserted pa_attribute after woo product title, how to assign a class for styling

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #782920
    Stacie Kliber

    Hi all at GP, I’ve inserted a Woo attribute to display after the product title using the action below – but now I can’t figure out how to assign a class to the attribute. Can it be done inside the snippet below? p.s. I know just enough to be dangerous, but I find answers to many of my questions here (so thank you!).

    /*add location after project title*/
    add_action(‘woocommerce_shop_loop_item_title’, ‘wh_insertAfterShopProductTitle’, 15);

    function wh_insertAfterShopProductTitle() {
    global $product;

    $location = $product->get_attribute(‘pa_location’);
    if (empty($location))
    return;
    echo __($location, ‘woocommerce’);
    }

    Any helpful info or resource would be much appreciated. ๐Ÿ™‚

    Thanks

    GP Premium 1.7.5

    #783067
    Stacie Kliber

    Here’s what I did:

    /*add location after project title*/
    add_action(‘woocommerce_shop_loop_item_title’, ‘wh_insertAfterShopProductTitle’, 15);

    function wh_insertAfterShopProductTitle() {
    global $product; $location = ‘<h6>’ . $product->get_attribute(‘pa_location’) . ‘</h6>’;
    if (empty($location)) return;
    echo __($location, ‘woocommerce’);
    }

    #783072
    Leo
    Staff
    Customer Support

    Glad you figured out ๐Ÿ™‚

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