Get started
Customization
Hooks (action & filter)
Hooks in WordPress essentially allow you to change or add code without editing core files. They are used extensively throughout WordPress and WooCommerce and are very useful for developers.
Read more about action and filter hooks here:
How and where to insert the code?
To get the functions exemplified in this section to work you need to add the code to your theme’s functions.php. You can add it as its own plugin or through the Code Snippets plugin, or something similiar of your choice.
Filters
Allow free orders in Avarda Checkout
As a WooCommerce default, when an order has 0 value (free trial, applied coupons…), Avarda Checkout is not loaded. Instead the standard WooCommerce checkout is loaded. If you have Avarda as the only payment method this means that the customer can’t complete the order.
With the filter below you allow free orders with Avarda Checkout.
/**
* Allow free orders using Avarda Checkout for WooCommerce.
*
* @return bool
*/
function aco_allow_free_orders() {
return true;
}
add_filter( 'woocommerce_order_needs_payment', 'aco_allow_free_orders', 999 );
add_filter( 'woocommerce_cart_needs_payment', 'aco_allow_free_orders', 999 );