0

I was trying to exclude product from coupons in WooCommerce and tried out a code I found on stackoverflow by another user. The code did what I wanted but upon trying to add a new product to my woocommerce I found out that the add product page is totally ruined.

You cannot click on anything in that page and the product tabs where you add description etc are all gone. I commented out the code I had previously pasted in functions.php but still the problem remains. I tried restore my files from a previous backup but still the problem remain. How can I revert this, im getting very desperate.

Link where I found the code: Exclude product from all coupons in WooCommerce

Thankful for all the help I can get.

  • 2
    This is my answer code. I just tested it again and it works perfectly on Woocommerce 3+. It only acts on your web site if it's saved on function.php file. So the issue you describe doesn't come from that code, if you have removed it. There is something else that is making that. Anyway, *You should always make/have a backup of your files and database.* – LoicTheAztec Jul 17 '18 at 00:21
  • The website was working absolutely fine before I inserted the code and have been for last 6 months. It changed something in my theme because when I change theme I can add product as normal. I put the code in my functions.php in my theme but then removed it, but somehow it still acts up in my theme. Do you have any clue to why? Its not even my website but a client and I feel really bad ruining it. @LoicTheAztec – Behappypro Jul 17 '18 at 00:26
  • 1
    Just tested the code and perfectly works… So something else is involved in your issue. The code just add a checkbox in product backend settings and when this checkbox is selected and saved, coupons are not applied to the product. This is custom meta data (a custom field) and doesn't make any changes on the product itself. – LoicTheAztec Jul 17 '18 at 00:32
  • Can I delete a file or folder that might have got changed in the process to revert everything back to normal? I did a full updraftplus restore on the site but still nothing changes. – Behappypro Jul 17 '18 at 00:33
  • It doesn't change any other file that the file where you saved it. So your issue is related to something else. It's seems like a hosting problem or something similar, that has happened just when you were testing the code. – LoicTheAztec Jul 17 '18 at 00:34
  • 1
    I must thank you and apologize for taking up your time. I was panicking so hard. I tried deactivating all my plugins and for some reason all in one seo pack was acting up and that was the problem. I dont know if the code had something to do with it but that plugin was working fine before. Anyhow, I tried using only your code and it seems to work fine. So once again, im really sorry if I wasted your time and Im grateful that you answered. Cheers! – Behappypro Jul 17 '18 at 00:43

0 Answers0