Fixing the Add Coupon button in Flatsome theme for Woocommerce

As I was building out Texas Forever (Shameless plug: has the greatest Texas Forever Shirts in the world), I ran into an issue with the Flatsome theme. When you were in the shopping cart and added a coupon code and then pressed “enter”, the page would refresh without actually applying the coupon code. The only way to actually apply the coupon for your Texas Forever shirt was to click the button.logo2-400x400

That wouldn’t do at all, so I went code diving. The file we need to update is buried in /wp-content/themes/flatsome/woocommerce/cart/cart.php

Ideally, you are running a child theme of Flatsome. Assuming you are, just copy the file to your child theme to duplicate it, and then work on it there. If you are NOT, you can still edit the Flatsome theme file, but know that when you update the theme your change will be gone.

The solution itself is really simple: The theme author has a </form> tag out of place, so when you pressed enter in the shopping cart of┬áit interprets the ‘enter’ as being to submit the form to “Update Cart” and not to submit the form to apply the coupon code.

By moving the </form> tag from line 170 to line 148, the problem is solved and everything works as expected!

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">