Title: Change Template through Code Snippet
Last modified: July 31, 2020

---

# Change Template through Code Snippet

 *  Resolved [sorakha](https://wordpress.org/support/users/sorakha/)
 * (@sorakha)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/change-template-through-code-snippet/)
 * Hi,
 * Is it possible to modify the archive-product.php template by using the Code Snippet
   plugin? I am working on a site that has this file overwritten in the theme, but
   they are not using a child theme so i cannot touch that file or it will be overwritten
   when they update. I am looking to information to the products that are displayed
   but by using code in the code snippet plugin. IE: The product archive doesn’t
   show the excerpt, i’d like to change that to be displayed using code snippet.
   I have only been able to find information on how to do this through a child theme.
 * Thanks

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

 *  Plugin Support [Kel C. a11n](https://wordpress.org/support/users/kellymetal/)
 * (@kellymetal)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/change-template-through-code-snippet/#post-13194482)
 * Hi there,
 * The `archive-product.php` file has a number of different “actions” that you can
   hook into to display information, or remove things from to prevent them from 
   being displayed.
 * Using those, you could write a snippet that hooks into the action and save it
   in the Code Snippets plugin. There’s an introduction to working with Hooks (Actions
   and Filters) available here:
    [https://docs.woocommerce.com/document/introduction-to-hooks-actions-and-filters/](https://docs.woocommerce.com/document/introduction-to-hooks-actions-and-filters/)
 * As you mentioned, it’s also possible to override template files, which we have
   documentation for below. Although though the site you are working on isn’t using
   a child theme now, it would be possible to create one as explained in the second
   link below:
    [https://docs.woocommerce.com/document/template-structure/](https://docs.woocommerce.com/document/template-structure/)
   [https://developer.wordpress.org/themes/advanced-topics/child-themes/](https://developer.wordpress.org/themes/advanced-topics/child-themes/)
 * I hope that helps!
 *  Thread Starter [sorakha](https://wordpress.org/support/users/sorakha/)
 * (@sorakha)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/change-template-through-code-snippet/#post-13195229)
 * This was just what I was looking for, thanks! 😀

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

The topic ‘Change Template through Code Snippet’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

## Tags

 * [archive-product](https://wordpress.org/support/topic-tag/archive-product/)
 * [code snippet](https://wordpress.org/support/topic-tag/code-snippet/)
 * [Template modification](https://wordpress.org/support/topic-tag/template-modification/)

 * 2 replies
 * 2 participants
 * Last reply from: [sorakha](https://wordpress.org/support/users/sorakha/)
 * Last activity: [5 years, 8 months ago](https://wordpress.org/support/topic/change-template-through-code-snippet/#post-13195229)
 * Status: resolved