WordPress.org

Ready to get started?Download WordPress

Forums

Sell Digital Downloads
[resolved] Hooking events (3 posts)

  1. Garry K
    Member
    Posted 3 months ago #

    I've installed your plugin and I have buttons for "Buy now" links.

    Next I want to hook into after the customer pays. I want to simply update 1 wp-usermeta field. I can do this in php. I need to know the userid and the product code.

    Is it possible to sub class? Put a php file in an area with a certain name and have it simply append to what is already there?

    The themes work this way which is great for maintainability. My mods aren't lost during an update.

    I have written a very secure web service in php. There are no less than 30 checks and balances, sanitization, encryption, JSON field counts and checkes, modified crc etc.

    I know a bit about programming. (Been doing mostly C / C++ for the last 30 years)

    Please point me in the right direction before I waste too much time digging in.

    https://wordpress.org/plugins/sell-digital-downloads/

  2. Garry K
    Member
    Posted 3 months ago #

    Well I jumped in an modified the plugin to suit my needs. It took about a day.

    Sub classing isn't really possible, but there were action hooks that I could follow. However, the code is reasonably well written.

    I did the following:

    1) Added a default Tax rate on the main isell page.
    2) Added an apply tax to products.
    3) Added a tax amount to the products list.
    4) Added a paid tax field to the order history.
    5) Added a tax column to the order list.
    5) Added a paid tax field to the edit page for orders.
    6) Also added a user name to the edit page for orders.
    7) Passed in the user name in the 'custom' field to paypal which gets returned.
    8) Passed the 'tax_rate' field to paypal or '0.00' if products apply tax is false.
    9) Updated the wp-usermeta table based on product name and user name.

  3. Garry K
    Member
    Posted 3 months ago #

    After a diligent code review it has come to my attention that this plugin does not check for processing the same transaction multiple times. This means that the sales count will be incremented each time a duplicate transaction comes in 'Completed'

    Also refunds do not adjust the sales count at all.

    And finally the manual edit and or creation of a sale does not adjust the sales count.

    I am going to put in the following checks and changes.
    1) If the current transaction is 'Completed' then check to see if we have already recorded a 'Completed' status.

    2) If the current transaction is 'Refunded' then decrement the sales count but only if we haven't already recorded a 'Refunded' status for the current transaction.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.