4

I have created a step by step variable product selection in WooCommerce 3.3.1 and I have a custom add to cart url, made this way:

$url=wc_get_checkout_url()."/?add-to-cart=".$loop->post->ID."&variation_id=".$variation['variation_id']."&attribute_pa_starter-box=".$variation['attributes']['attribute_pa_starter-box'];

Then I have added the url to a custom checkout button, but the problem is that when I click on checkout button it adds the product twice to the cart.

I can not understand where I'm wrong… Any help is appreciated.

Aaron
  • 115
  • 8
  • 2
    So you should try to update to minor version 3.3.5 first… Then *"Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error **and the shortest code necessary to reproduce it in the question itself**..."* – LoicTheAztec Apr 06 '18 at 20:01
  • @LoicTheAztec Thank you, I will update the Woocommerce to 3.3.5 and then check if it is still there or not. I will let you know here. – Pankaj Thakur Apr 08 '18 at 06:37
  • How did you solve the issue in the end ? The same happens to me more than a year after :) – Victor Dec 15 '19 at 21:53
  • @Victor I cleared all the cookies and disabled the cache plugin after flushing the cache, then it was working fine with no issue. Please let me know if this works for you too. – Pankaj Thakur Dec 17 '19 at 08:01
  • I was using the built-in add-to-cart URL generator that somehow was misplacing something. I did not invest too much time in debugging it, I just recreated the URL as you mention in the post and it work. So I had a slightly different scenario than you. – Victor Dec 17 '19 at 09:34
  • Good to hear it worked for you :) – Pankaj Thakur Dec 22 '19 at 19:58

0 Answers0