Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // hook woocommerce_single_variation?
- add_action( 'woocommerce_single_variation', 'custom_attributes', 10 );
- function custom_attributes(){global $product;
- if ( get_post_type( $post ) === 'product' && ! is_a($product, 'WC_Product') ) {
- $product = wc_get_product( get_the_id() ); // Get the WC_Product Object
- }
- $product_attributes = $product->get_attributes(); // Get the product attributes
- // Raw output
- echo '<pre>'; print_r( $product_attributes ); echo '</pre>';}
- // Get custom product attributes
- https://stackoverflow.com/questions/13374883/get-custom-product-attributes-in-woocommerce
Add Comment
Please, Sign In to add comment