Title: Like a function.php code
Last modified: July 22, 2022

---

# Like a function.php code

 *  Resolved [NikkaG](https://wordpress.org/support/users/nikkag/)
 * (@nikkag)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/like-a-function-php-code/)
 * 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)

 *  [Temyk](https://wordpress.org/support/users/webtemyk/)
 * (@webtemyk)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/like-a-function-php-code/#post-15855013)
 * Hello.
 * What are your snippet settings?
 *  Thread Starter [NikkaG](https://wordpress.org/support/users/nikkag/)
 * (@nikkag)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/like-a-function-php-code/#post-15855278)
 * 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.
 *  [Temyk](https://wordpress.org/support/users/webtemyk/)
 * (@webtemyk)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/like-a-function-php-code/#post-15855448)
 * 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](https://wordpress.org/support/users/nikkag/)
 * (@nikkag)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/like-a-function-php-code/#post-15855472)
 * 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.

 * ![](https://ps.w.org/insert-php/assets/icon-256x256.gif?rev=3475630)
 * [Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts](https://wordpress.org/plugins/insert-php/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/insert-php/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/insert-php/)
 * [Active Topics](https://wordpress.org/support/plugin/insert-php/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/insert-php/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/insert-php/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [NikkaG](https://wordpress.org/support/users/nikkag/)
 * Last activity: [3 years, 8 months ago](https://wordpress.org/support/topic/like-a-function-php-code/#post-15855472)
 * Status: resolved