Home › Forums › WoodMart support forum › Allow Show Variation Description on Page Single Product
Allow Show Variation Description on Page Single Product
- This topic has 1 reply, 2 voices, and was last updated 3 years, 4 months ago by Elise Noromit.
-
AuthorPosts
-
August 6, 2021 at 11:59 pm #311226
esaacoParticipantHello Support Team
I need to show the Variation description according to the Select of variationI tried with this code in Function.php but Not work :
`add_action( ‘woocommerce_after_add_to_cart_form’, ‘description_below_add_cart’, 11 );
function description_below_add_cart() {
global $product;$terms_slugs = wp_get_post_terms( $product->get_id(), ‘product_cat’, array(‘fields’ => ‘slugs’) ); // Get the terms slugs
// Only for ‘cookware’ product category
if ( in_array( ‘cookware’, $terms_slugs ) ) {
$weight = $product->get_weight();
$weight = ! empty($weight) ? wc_format_weight($weight) : ”;$dimensions = $product->get_dimensions(false);
$dimensions = ! empty($dimensions) ? wc_format_dimensions($dimensions) : ”;// For variable products
if ( $product->is_type(‘variable’) ) {
// Display the selected variation description
echo ‘<div class=”selected-variation-description”></div>’;
?>
<script type=”text/javascript”>
jQuery( function($){
// On select variation display variation description
$(‘form.variations_form’).on(‘show_variation’, function( event, data ){
$(‘div.selected-variation-description’).html(data.variation_description);
console.log(data.variation_description);
});
// On unselect variation remove variation description
$(‘form.variations_form’).on(‘hide_variation’, function(){
$(‘div.selected-variation-description’).html(”);
});
});
</script>
<?php
}
}
}Attachments:
You must be logged in to view attached files.August 7, 2021 at 7:16 pm #311332
Elise NoromitMemberHello,
By default, Woocommerce does not provide the option and our theme does not have the option either. Woocommerce customization is not covered by our support that is why you will need to find a plugin or developer who would implement that for you.
We have not tested or met a plugin giving these options that is why we can hardly recommend it.
Best Regards
-
AuthorPosts
Tagged: product variation description
- You must be logged in to create new topics. Login / Register