I am pretty new using WordPress and was asked to validate the number of items in the cart for an eCommerce site that lets you "make a pack" in which you have several steps, step 1 is a page in which you select the box, this doesn't need validation but the next 4 steps do, each step is a new page and each has a different amount of the item that you need to select, what I need is to either disable the hyperlink that says "Next step" until you select the correct amount of items for each step or just display a message when you click with the incorrect amount

Now my question is not code itself but where to put it in WordPress, I checked everything in the WordPress admin part of the site and on the hosting site but can't find where I am supposed to code the validation for each page.

  • Where you put it depends on how you implement it. A new plugin is probably a safe bet. A new plugin is a safe bet. A pre-existing site-specific plugin if it already exists. Or the theme's files, if the theme is custom, or a customized child theme.
    – bosco
    Aug 10, 2018 at 14:07

1 Answer 1


Normally on WordPress you use Your Theme Functions.php to put that code. But in this case we are talking about a WordPress with WooCommerce (I'd think), so if you add custom code to your theme as I told you normally is the case, it will be gone if you change your theme, for that reason and if you aren’t sure where to place the code, choose one of the following options to add the code to your site.


Use the Code Snippets plugin or similar.


Use Simple Custom CSS and JS.

Not the answer you're looking for? Browse other questions tagged or ask your own question.