• Store URL: not yet available
    WordPress version: 4.1
    WP eCommerce version: 3.9.1
    Gold Cart version: –
    Theme: custom and default themes

    Hi,
    I am trying to run some PHP code after every successful purchase using the wpsc_payment_successful action hook.

    I have added the following code to the functions.php file:

    add_action( ‘wpsc_payment_successful’ , ‘purchase_complete’ );

    I have made numerous succesful purchases but the function is never run. I have tested the PHP code and function to make sure there are no errors and it works fine when called upon by other means. So it’s the wpsc_payment_successful that is not working as it should.

    I have tried disabling all plugins except WP eCommerce and changing to a different theme but it doesn’t help.

    When searching on the issue I’ve found that there has been problems with this hook as far back as 2012:

    https://www.ads-software.com/support/topic/plugin-wp-e-commerce-wpsc_payment_successful-hook-not-working-with-paypal-pro?replies=4#post-2882178

    If there would be some kind of workaround, alternative method or quick fix to check for succesful purchases this would be much appreciated. Using wpsc_confirm_checkout will not suffice as the payment can be pending or failed.

    As further development it would be nice if I could get identify the product that was purchased by id and have the function run slightly different code depending on the product. Is there any way to get the product id from a successful purchase?

    Thank you!

    https://www.ads-software.com/plugins/wp-e-commerce/

Viewing 1 replies (of 1 total)
  • Thread Starter thorwik

    (@thorwik)

    I tried to create a similar solution using a sessionid check, MySQL queries to get product ID and check that the processed status is 3 before running the code.

    The problem is that since I check for the get parameter sessionid a page refresh means that the code can be run multiple times even if you only do one purchase. I imagine the action hook would be triggered only once per purchase and not react to page refreshes, so it would be better if the hook was working.

Viewing 1 replies (of 1 total)
  • The topic ‘wpsc_payment_successful action hook not working in WPeCommerce 3.9.1’ is closed to new replies.