• Resolved lingenChan

    (@lingenchan)


    Hi there,

    I developed a simple filter to hook up one element in the variations array but doesn’t seem to work, is returning me the following error: ‘PHP fatal error Call to a member function get_description() on array.’

    The snippet is the following:

    function change_variation_descriptions( $variation ) {
    		global $variation;
    		$variation['variation_description'] = wc_format_content( htmlspecialchars_decode($variation->get_description()) );
    		return $variation;
    }
    add_filter( 'woocommerce_available_variation', 'change_variation_descriptions');

    Could you please help me?

    Thanks,

    • This topic was modified 6 years, 6 months ago by lingenChan.
Viewing 1 replies (of 1 total)
  • In this case $variation is an array. You are using $variation as object: $variation->get_description()

Viewing 1 replies (of 1 total)
  • The topic ‘Modify variation description’ is closed to new replies.