Skip to content

Instantly share code, notes, and snippets.

@pingram3541
Created June 29, 2020 00:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pingram3541/9acfdf530df686e0f9fc799f46fe8cc4 to your computer and use it in GitHub Desktop.
Save pingram3541/9acfdf530df686e0f9fc799f46fe8cc4 to your computer and use it in GitHub Desktop.
Shortcode to produce WooCoomerce Product Attributes
//Shortcode to output product attribute
function product_list_attribute_func( $atts ){
global $product;
$atts = shortcode_atts( array(
'name' => '',
), $atts );
if( is_string( $atts['name'] ) ){
//get attribute
$prod_attribute = $product->get_attribute( $atts['name'] );
return $prod_attribute;
}
}
add_shortcode('product_list_attribute', 'product_list_attribute_func');
@semmtex
Copy link

semmtex commented Dec 9, 2020

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment