Hooks

cart66_after_add_to_cart

Expected parameters

  • product: The Cart66Product object that was added to the cart
  • quantity: An integer which is the quantity of the product added to the cart

This hook is called any time a product is added to the Cart66 shopping cart. The cart66_after_add_to_cart hook will pass two parameters, the Cart66Product and the quantity that was added to the cart.

This hook will only be triggered if the product was successfully added to the cart. If the product did not get added to the cart because of inventory restrictions, trying to place multiple subscription products in the cart, or any other reason, this hook will not be called.

Suppose you wanted to bypass the “View Cart” page and go straight to the checkout page and also get an email every time someone added a product to their shopping cart. You could write a very simple plugin like this:

The call to add_action has four parameters.

  1. ‘cart66_after_add_to_cart’ is the name of the action hook
  2. ‘goToCheckout’ is the name of your callback function
  3. 10 is the priority of your function
  4. 2 is the number of parameters your function takes

See the documentation for the add_action() function for more information about the parameters it can take.

cart66_after_update_cart

Expected parameter:

  1. cart: A Cart66Cart object in the state just after the cart was updated

This hook is called after the cart is updated. Updating the cart includes the following actions:

  • Changing the quantities of products in the cart
  • Setting or changing shipping methods
  • Setting or changing custom field information in the view cart mode
  • Setting or changing a promotion

Note that this hook is not called when a product is removed from the cart by clicking the trash can icon.

Example usage:

cart66_after_remove_item

Expected parameters:

  • cart: A Cart66Cart object in the state just after the cart was updated
  • product: The Cart66Product object that was removed from the cart

This hook is called immediately after an item is removed from the cart by clicking the trash can icon in the shopping cart. This hook will not be called if the item is removed from the cart by setting its quantity to zero then clicking “Update Total” button.

Example usage:

cart66_after_order_saved

Expected parameter:

  • orderInfo: An array containing the order information

This hook is called after an order has been successfully saved. The id in the array is the primary key in the wp_cart66_orders table. This id can be used to gather additional information about the order such as the items that were purchased. If the order created an account, such as if a membership or subscription was sold, the account_id value is the primary key from the wp_cart66_accounts table and will be an integer greater than zero. If no account was created the account_id will be zero.

The orderInfo array contains the following data:

0

This site is documentation for Cart66 Pro which is no longer maintained. View the Cart66 Cloud Documentation.
What Happened to Cart66 Pro?