Attribute Shortcode

Hello,
Could I get some clarification on this post for creating a short code for attributes?

I have an Attribute for “Ships In”. I have placed the following in the functions.php

add_shortcode( ‘product_attributes’, ‘get_product_language’ );
function get_product_language()
{
global $product;
$product_attributes = $product->get_attributes();
$book_language = $product->get_attribute(‘pa_language’); // ships-in
return $book_language;
}

I wasn’t quite sure if the slug for Ships In should be used or the just as is.
Also, what would the structure of the shortcode in the editor be?

Thank you.

Hey @tso,

Thanks for reaching out!

I don’t see any issue with your function for shortcode and based on your code, your shortcode to be pasted in the editor is [product_attributes]

Hope that helps.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.