Home Forums WoodMart support forum Allow Show Variation Description on Page Single Product

Allow Show Variation Description on Page Single Product

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #311226

    esaaco
    Participant

    Hello Support Team
    I need to show the Variation description according to the Select of variation

    I 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.
    #311332

    Hello,

    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

Viewing 2 posts - 1 through 2 (of 2 total)