Created
June 29, 2020 00:23
-
-
Save pingram3541/9acfdf530df686e0f9fc799f46fe8cc4 to your computer and use it in GitHub Desktop.
Shortcode to produce WooCoomerce Product Attributes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks.