I'm attempting to display the selected product variation description on my single product page after add to cart button on variable product pages.
Below is the code I've implemented, but it does not appear to be working:
add_action( 'woocommerce_after_add_to_cart_form', 'description_below_add_cart', 11 );
function description_below_add_cart() {
global $post;
$terms = wp_get_post_terms( $post->ID, 'product_cat' );
foreach ( $terms as $term ) $categories[] = $term->slug;
if ( in_array( 'cookware', $categories ) ) {
global $product;
$weight = $product->get_weight();
$dimensions = wc_format_dimensions($product->get_dimensions(false));
echo '<div class="short-description">' . $item['product']->get_description() .'</div>';
}
}
Here is a product page from the site.
How can I display specific data (the variation description) from selected product variation in Woocommerce after add to cart button for variable products?