Skip to content

Instantly share code, notes, and snippets.

@corsonr
Last active April 9, 2022 15:38
Show Gist options
  • Save corsonr/6182904 to your computer and use it in GitHub Desktop.
Save corsonr/6182904 to your computer and use it in GitHub Desktop.
WooCommerce - Add custom fee to cart
<?php
/**
* WooCommerce Extra Feature
* --------------------------
*
* Add custom fee to cart automatically
*
*/
function woo_add_cart_fee() {
global $woocommerce;
$woocommerce->cart->add_fee( __('Custom', 'woocommerce'), 5 );
}
add_action( 'woocommerce_cart_calculate_fees', 'woo_add_cart_fee' );
@vp956009
Copy link

vp956009 commented Jun 8, 2021

Extra Cost For Woocommerce you can use this plugin that is good for it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment