Support » Plugin: WooCommerce » Overwrite / add to function download pdf product

  • Hi

    I have created a hack, so it is possible to sell PDF files which get stamped with coustomer information and get a password (customer email).

    I have done the hack direct in the core file woocommerce-functions.php (the function woocommerce_download_product() )

    I would like to hear if it is possible to do the changes / overwrite the function in a more elegant way, because next time woocommerce get updated the changes would be lost.

    My plan are to create it as a free plugin / extention / modification.

    Anybody there can help?

    Best Regards
    Jesper Vels

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi Jesper,

    I am trying to extend the download_product functionality also.

    Looking through the documentation I think the best way to do this is by building a plugin & creating a function that uses the hook woocommerce_download_product (as listed in woocommerce-functions.php)

    The trigger for this is

    // Trigger action
    		do_action( 'woocommerce_download_product', $email, $order_key, $product_id, $user_id, $download_id, $order_id );

    I just need to work out how to get this to work with my plugin I am currently using
    add_action('woocommerce_download_product', array('woocommerce_myluginclass', 'mypluginfunction')); but it doesn’t seem to do anything.

    I suspect this will be depending on the options set for the File Download Method

    If you make any progress please let me know.

    I have been doing some further digging in the source.


    Should only activate once the payment has been accepted as correct, could this be a better option?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Overwrite / add to function download pdf product’ is closed to new replies.