javascript - minicart.js not working, cart is not popping up -
i using minicart.js simple paypal shopping cart. not working should. cart not popping if click 'add cart' button.
here's code.
<html> <body> <script src="//cdnjs.cloudflare.com/ajax/libs/minicart/3.0.3/minicart.min.js"></script> <script> paypal.minicart.render(); </script> <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_cart" /> <input type="hidden" name="add" value="1" /> <input type="hidden" name="business" value="labs-feedback-minicart@paypal.com" /> <input type="hidden" name="item_name" value="test product" /> <input type="hidden" name="quantity" value="1" /> <input type="hidden" name="amount" value="1.00" /> <input type="hidden" name="currency_code" value="usd" /> <input type="hidden" name="no_shipping" value="2"> <input type="hidden" name="no_note" value="1"> <input type="hidden" name="shipping2" value="1.50"> <input type="hidden" name="shipping" value="2.50"> <strong>test product</strong> <p> <label><input type="checkbox" id="terms" name="terms" value="" /> agree terms</label> </p> <input type="submit" name="submit" value="add cart" /> </form> <script> paypal.minicart.render(); paypal.minicart.cart.on('checkout', function (evt) { var hasagreed = !!document.getelementbyid('terms').checked; if (!hasagreed) { alert('you must agree terms!'); evt.preventdefault(); } }); </script> </body> </html>
here actual site. , found error in console said:
uncaught typeerror: cannot call method 'appendchild' of null
i not sure how fix this, please let me know what's wrong setup. thanks.
you need change add cart button not saved on paypal (in profit , loss section) , unprotect code after button created right before copy , paste :)
hope helps :)
Comments
Post a Comment