Skip to main content

Override Default Checkout Behavior with a Plugin

caution

Bold Commerce encourages developers to use integrations in order to extend Bold Checkout, instead of plugins. There are two types of integrations: private and public. For more information, refer to Extending Bold Checkout.

Plugin overrides are actions that enable Checkout Plugins to bypass certain Bold Checkout behavior in favor of custom functionality.

The following overrides are available to plugin developers:

  • override_address_validate
  • override_discount
  • override_inventory
  • override_shipping
  • override_tax

This document explains the structure of overrides and how to implement them. For more information about overrides in general, refer to Checkout Overrides.

note

Plugin overrides differ in several ways from API overrides. Refer to API overrides and plugin overrides for more information.

How plugin overrides work

The following diagram and steps show an example of setting up and triggering a tax override.

  1. When a customer proceeds to checkout, the frontend makes a call to the Initialize Order endpoint to begin the checkout process.
  2. Bold Checkout sends the initialize_checkout event to all plugins registered to receive it on that store. While you can create an override at any point in the checkout flow, establishing the override early ensures that it will be in place before it is needed.
  3. The plugin responds to Bold Checkout with an override_tax action. This payload contains a custom URL defined by the plugin.
  4. Bold Checkout returns the application state in response to the frontend's Initialize Order call.
  5. As the customer proceeds through the checkout, the store makes a call to the Generate Taxes endpoint. This triggers the tax override.
  6. Instead of using Bold Checkout functionality to calculate taxes, Bold Checkout makes a call to the plugin's tax override URL provided in Step 3. Details about this request can be found in the Plugin Actions reference.
  7. The plugin performs custom tax calculations and responds to Bold Checkout with the appropriate tax information. Details about the response that Bold Checkout expects can be found in the Plugin Actions reference.
  8. Bold Checkout updates and returns the application state.

Plugin actions

Plugin overrides are created using plugin actions. For more information about these actions, refer to the Plugin actions reference.