• Resolved NikkaG

    (@nikkag)


    I need to override WooCommerce core function wc_display_item_meta().

    I tested my code in functions.php and it works:

    function wc_display_item_meta( $item, $args = array() ) {
    // etc...
    }

    I tried to move my code from functions.php to a Woody Snippet but I cannot save it, the error is:
    Cannot redeclare wc_display_item_meta() (previously declared in /plugins/woocommerce/includes/wc-template-functions.php:3347)

    Any solution?

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Temyk

    (@webtemyk)

    Hello.

    What are your snippet settings?

    Thread Starter NikkaG

    (@nikkag)

    Hello Temyk,

    snippet setting is “Run everywhere” but I cannot save it also if I set “Where there is a shortcode”.

    In Woody Snippet settings I have “Activate by Default = ON”, I already tried to set it OFF. Other settings are OFF.

    Plugin Support Temyk

    (@webtemyk)

    The snippet is called after Woocommerce has been initialized, so this function has already been declared. Therefore, it will not be possible to redefine this function in the snippet.

    Thread Starter NikkaG

    (@nikkag)

    I assumed it was so, I hoped to solve it with snippet “priority”.

    I must put my code in functions.php

    Thanks for the quick answer!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Like a function.php code’ is closed to new replies.