PHP code example of pronamic / pronamic-payment-gateways-fees-for-woocommerce
1. Go to this page and download the library: Download pronamic/pronamic-payment-gateways-fees-for-woocommerce library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pronamic / pronamic-payment-gateways-fees-for-woocommerce example snippets
\Pronamic\WooCommercePaymentGatewaysFees\Plugin::instance()->setup();
/**
* Calculate totals for the items in the cart.
*
* @uses WC_Cart_Totals
*/
public function calculate_totals() {
$this->reset_totals();
if ( $this->is_empty() ) {
$this->session->set_session();
return;
}
do_action( 'woocommerce_before_calculate_totals', $this );
new WC_Cart_Totals( $this );
do_action( 'woocommerce_after_calculate_totals', $this );
}
/**
* Run all calculation methods on the given items in sequence.
*
* @since 3.2.0
*/
protected function calculate() {
$this->calculate_item_totals();
$this->calculate_shipping_totals();
$this->calculate_fee_totals();
$this->calculate_totals();
}