WordPress.org

Ready to get started?Download WordPress

Forums

Cart66 plugin - hook into checkout process (3 posts)

  1. Sam De Francesco
    Member
    Posted 2 years ago #

    Hi all,

    I'm trialling Cart66 Lite, with the hope of using the full version in an upcoming website. We want to use it for registrations, such that when a user pays for an event or course, we submit an entry to the enrollment database with the product ID and username on successful payment.

    What I'm trying to look for is a way to hook into the checkout/fulfillment process to update the database with this information. We plan to use Paypal express and authorize.net. Getting the logged in username is easy enough, I will also need to product id of the item payed for, and some indication that the transaction was successful.

    I'm thinking that the receipt page might be the best spot, but just wondering if anyone else has experience with something similar to point me in the right direction.

    cheers
    sam

  2. reality66
    Member
    Posted 2 years ago #

    First, don't use PayPal Express and Authorize.net, if you do it will be hard (and expensive) to get your site to be PCI compliant since you will be passing credit card data from server to server via API calls. Instead, take a look at Mijireh Checkout http://mijireh.com

    Cart66 (pro and lite) have the following hooks built in:
    cart66_after_order_saved
    cart66_after_remove_item
    cart66_after_add_to_cart
    cart66_before_add_to_cart
    cart66_after_update_cart

    The cart66_after_order_saved hook is the one it sounds like you will want to use. This hook passes one parameter which is the Cart66Order object that was just saved. The Cart66Order class is located in cart66/models/Cart66Order.php where you can see the available functions. The getItems() function is probably what you will want to call to get a list of the items that were purchased.

    The code you will want to write will probably look something like this:


    add_action('cart66_after_order_saved', 'log_enrollment');
    function log_enrollment($order) {
    $items = $order->getItems();
    foreach($items as $item) {
    // do whatever you need to do for enrollment
    }
    }

  3. candlesyp
    Member
    Posted 2 years ago #

    Hi reality66,

    Can you try to help me with my Cart66 Lite issue here;

    http://wordpress.org/support/topic/cart66?replies=2#post-2882778

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic