Skip to content

Instantly share code, notes, and snippets.

@EmranAhmed
Forked from corsonr/gist:6182904
Last active August 29, 2015 14:11
Show Gist options
  • Select an option

  • Save EmranAhmed/26c81c27dc96b3ac6422 to your computer and use it in GitHub Desktop.

Select an option

Save EmranAhmed/26c81c27dc96b3ac6422 to your computer and use it in GitHub Desktop.
woocommerce Add custom fee / price to cart automatically
<?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_before_calculate_totals', 'woo_add_cart_fee' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment