CartThrob Fees Version 3.0.0

CartThrob Fees enables your CartThrob powered site to capture fees based on specific customer locations, item options, or custom data that's been set in your cart.

Like other CartThrob add-ons, CartThrob must be active for it to run. To use this addon, you will need to configure the settings, and it's advisable to add template tags to output fees information.

All fees are added to the cart as non-removable cart items. Like other items, they will be listed as order items in the customer cart history, and will be saved with other order items. Sample template code can be found here in the documentation.

Features

  • Multiple fees can be set
  • Fees can be based on customer location information, cart contents, or other custom data
  • Fees are saved like any other product in the order channel.

Requirements

  • ExpressionEngine 5.0+
  • CartThrob 5.0+
  • PHP 7.1+

Installation

  • Upload the /cartthrob_fees/ folder to /system/user/addons/
  • Make sure Extensions are enabled on your system
  • Install the CartThrob Fees add-on (through EE's add-ons panel)

Upgrading

Download the add-on and unzip its contents.

Upload the add-on’s folder to your system/user/addons/ folder, replacing the existing copy of the add-on in full.

Once the add-on is uploaded, you should see it listed as being available for update in the Add-on Manager in your ExpressionEngine Control Panel. You can then click update!

Upgrading from versions prior to 3.0.0

Upgrading to Fees 3.0.0 may require no additional actions outside of the standard upgrade instructions noted above.

With that said, version 3.0.0 does contain several notable changes that you may need to be aware of depending on your usage.

  1. The cartthrob_fees_settings table is updated to include a new primary key of id. This change was made to support the use of the new CartThrob\Fees\Model\Setting Model.
  2. The serialized column is removed from the cartthrob_fees_settings table in favor of using ExpressionEngine's native serialized Composite Type on the value column.
  3. The cartthrob_fees_table table is removed and replaced with a new cartthrob_fees table. Existing fees are migrated to this new table where each fee setting exists as a unique column in the database rather than as serialized data.
  4. Interaction with the new cartthrob_fees table occurs through the CartThrob\Fees\Model\Fee Model.
  5. The {exp:cartthrob:get_fees} now includes :numeric suffixes for the {fee_price} and {fee_total} variables in the {exp:cartthrob:get_fees} tag, allowing you to output either the raw numeric value or the formatted value in accordance with CartThrob's number formatting settings.

Settings

For each fee you set, you can specify a flat fee, or a percentage of the subtotal (before fees). You can set each fee to activate based on a number of settings including

  1. Always apply fee
  2. Based on contents of a custom data field
  3. Based on the contents of an item option
  4. Or based on the contents of customer data.

Backend Settings Backends Settings.

Tags

get_fees

Outputs information about all of the fees currently active in the cart

fee_price

Fee price with prefix (ex. $4.50)

fee_price:numeric

Fee price (numeric) (ex. 4.50)

fee_total

Fee total with prefix (ex. $4.50)

fee_total:numeric

Fee total (numeric) (ex. 4.50)

fee_percent

Fee percent (if any)

fee_name

Fee descriptive name

{if no_results}

Conditional will display if no fees are set.

Example
{exp:cartthrob:get_fees}

    Fee total with prefix {fee_total}
    Fee total (numeric) {fee_total_numeric}
    Fee percent (if any) {fee_percent}
    Fee descriptive name {fee_name} 

    {if no_results}no fees were added{/if}

{/exp:cartthrob:get_fees}

fees_total

Total amount of fees currently active in cart

{exp:cartthrob:fees_total}