• Resolved AJD

    (@ajd)


    We are using variation descriptions for our Google Shopping feed, but don’t want them to show above the add to cart when a variation is selected, before adding it to the cart. I’d rather remove it via a hook or filter rather than hiding with css.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Saif

    (@babylon1999)

    Hello @ajd,

    Thank you for reaching out!

    I understand you want to remove the variation description above the add-to-cart button, correct?

    There isn’t a ready-to-use hook for this as the visibility of the description is controlled by JavaScript according to the select variation.

    You might want to give this approach a shot, although I’m not sure if it will affect the functionality of the Google plugin as well:

    function hide_variation_description($data, $product, $variation) {
        $data['variation_description'] = ''; 
        return $data;
    }
    add_filter('<meta http-equiv="content-type" content="text/html; charset=utf-8"></meta>woocommerce_available_variation', 'hide_variation_description', 10, 3);

    You can find the default values of the woocommerce_available_variation hook here.

    If you need help building a custom solution for WooCommerce, consider hiring one of our certified WooExpert agencies.

    Hope this helps!

    Saif

    (@babylon1999)

    I just noticed there are random characters added to the hook name somehow, please try this snippet instead. :?)

    function hide_variation_description($data, $product, $variation) {
        $data['variation_description'] = ''; // Set the variation description to an empty string
        return $data;
    }
    add_filter('woocommerce_available_variation', 'hide_variation_description', 10, 3);
    

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to Hide the Variation Description?’ is closed to new replies.