Download the PHP package pronamic/pronamic-payment-gateways-fees-for-woocommerce without Composer
On this page you can find all versions of the php package pronamic/pronamic-payment-gateways-fees-for-woocommerce. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pronamic/pronamic-payment-gateways-fees-for-woocommerce
More information about pronamic/pronamic-payment-gateways-fees-for-woocommerce
Files in pronamic/pronamic-payment-gateways-fees-for-woocommerce
Package pronamic-payment-gateways-fees-for-woocommerce
Short Description This WordPress plugin adds settings to all WooCommerce gateways to add a fixed and/or variable (percentage) fee.
License proprietary
Homepage https://www.pronamic.shop/product/pronamic-payment-gateways-fees-for-woocommerce/
Informations about the package pronamic-payment-gateways-fees-for-woocommerce
Pronamic Payment Gateways Fees for WooCommerce
This WordPress plugin adds settings to all WooCommerce gateways to add a fixed and/or variable (percentage) fee.
- Introduction
- Installation
- Screenshots
- Flow
- Links
Introduction
This WordPress plugin adds settings to all WooCommerce gateways to add a fixed and/or variable (percentage) fee.
Installation
Screenshots
Flow
WooCommerce recommends using the woocommerce_cart_calculate_fees
hook to add fees:
We suggest using the action woocommerce_cart_calculate_fees hook for adding fees.
This hook is called as soon as the WC()->cart->calculate_totals()
function is called, WooCommerce uses the WC_Cart_Totals
class to calculate totals:
class-wc-cart.php
When creating a WC_Cart_Totals
instance, the WC_Cart_Totals->calculate()
function is executed:
class-wc-cart-totals.php
What can be seen here is that the final totals are calculated after calculating the fee totals. This means that the order total is not yet available within the woocommerce_cart_calculate_fees
hook. In other words, within the woocommerce_cart_calculate_fees
hook the result of $cart->get_total( '' )
will always be 0
.
This is inconvenient because the payment gateway fees are often based on the total amount to be paid. That's why we hook into the woocommerce_after_calculate_totals
hook and recalculate the totals again. This extra calculation seems double, but it seems to be the easiest way to reliably request the cart total.
Links
All versions of pronamic-payment-gateways-fees-for-woocommerce with dependencies
automattic/jetpack-autoloader Version ^3.0
pronamic/pronamic-wp-updater Version ^1.0
pronamic/wp-number Version ^1.3