Product is not added to cart

I have a problem with adding a product on the website to cart. This website was not developed by me, so at first I looked through the code and found a “button” which calls popup for a quick order, here it is (wp-content/themes/mytheme/woocommerce/single-product/price.php):

<a href="#" class="btn add-to-cart eModal-1" data-product="<?=$product->id;?>" onclick="yaCounter33486453.reachGoal('oneclick'); return true;"><? echo __('submit your application', 'lati')?></a>

I have changed it to:

<a href="http://example.com/?add-to-cart=<?=$product->id;?>" class="btn add-to-cart" data-product="<?=$product->id;?>"><?php echo esc_html( $product->single_add_to_cart_text() ); ?></a>

So when I click on this button it just redirects to the main page and nothing happens. I have tried to redirect to /cart/?add-to-cart=id;?> but still nothing, it says that the cart is empty.

What am I doing wrong?

Read more here: Product is not added to cart

Leave a Reply

Your email address will not be published. Required fields are marked *