WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Force document download before add to cart (3 posts)

  1. cdmpta
    Member
    Posted 1 year ago #

    I need to force customers to download an agreement before adding an item into the cart; so if they click on the add-to-cart button, they get a prompt to download the required pdf. How would I do this?

    Example on this page

    http://webstores.activenetwork.com/school-software/corona_del_mar_higu3/index.php?l=product_detail&p=487#.UKwFlIbn9jc

    Thanks!

    http://wordpress.org/extend/plugins/woocommerce/

  2. bheadrick
    Member
    Posted 1 year ago #

    this would require a bit of jquery to do, but it's definitely doable.

    I'm not sure if you could really confirm that the file was fully downloaded, but you could check whether the link had been clicked. You would need to make your download link have a class of "download" for this to work.

    (function($) {
    
    var checkclick = false;
    $('a.download').click(function(){
    checkclick=true;
    return true;
    }
    $('form.cart button').click(function(event){
    if(!checkclick){
    event.preventDefault();
    $('form.cart button').before('<span id="message"><div class="error_message"><div class="error_alert">You must download the waiver before you can purchase "Transcript (Former Student)"<br></div></div></span>');}
    });
    })( jQuery );
  3. cdmpta
    Member
    Posted 1 year ago #

    Thank you so much - and yes, you are right. I just need to prompt the customer to click on the download link. I will give this a try. Happy Thanksgiving!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic