Skip to content

Instantly share code, notes, and snippets.

@webmasterninjay
Last active February 12, 2021 18:34
Show Gist options
  • Save webmasterninjay/1083fce16cad7d6dd1186d6c22445acf to your computer and use it in GitHub Desktop.
Save webmasterninjay/1083fce16cad7d6dd1186d6c22445acf to your computer and use it in GitHub Desktop.
Woocommerce: Add Additional Fee on cart
<?php
// Add additional fee ( Handling Fee etc. )
add_action( 'woocommerce_cart_calculate_fees','theme_prefix_additional_fees' );
function theme_prefix_additional_fees() {
global $woocommerce;
if ( is_admin() && ! defined( 'DOING_AJAX' ) )
return;
$fee = 5.00; // add amount
$woocommerce->cart->add_fee( 'Handling', $fee, true, 'standard' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment