• Resolved rolandc3

    (@rolandc3)


    Hello!

    I recently inserted the codes below to my site’s thankyou.php so that I’ll be able to track any affiliate-related transactions. I followed the documentation of my affiliate platform (https://www.postaffiliatepro.com/integration-methods/integration/woocommerce/).

    When I was finished, I read somewhere that if my WP theme updates or the plugin updates, the codes I inserted will disappear?

    I’m not a developer but I’m trying to figure things out. I hope someone here can tell me what to do to keep those codes in that php file regardless of any updates.

    Thanks so much!

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

    (@fullysupportedphil)

    Automattic Happiness Engineer

    Hey @rolandc3

    When I was finished, I read somewhere that if my WP theme updates or the plugin updates, the codes I inserted will disappear?

    That’s correct. If you make changes directly to the files of a theme or plugin, those changes will be lost when you update that theme/plugin.

    This is why we recommend never directly editing files. Instead, changes should be placed in their on area.

    In your case, what you’d want to do is create a child theme. Then add a template override in your theme that contains the custom code.

    Your theme’s developer should be able to provide you with a child theme.

    You can then follow the guide on this page to get the templates for your version of WooCommerce:
    https://docs.woocommerce.com/document/template-structure/

    You’ll want to add the appropriate template (thankyou.php) to your child theme and then make the changes there. This way when you update WooCommerce your changes won’t be lost, as they are contained in your child theme.

    If you need help implementing this, I’d suggest checking sites like https://www.codeable.io for skilled third-party developers.

    AJ a11n

    (@amandasjackson)

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘What will happen to the codes I inserted to thankyou.php if an update happens?’ is closed to new replies.