How to Remove Social Link Options from...
Optimize your MyListing website’s submit form by easily removing unwanted socia...

WPCodeBox
299

Enhance your WooCommerce store with this code snippet to easily add a surcharge percentage to all orders. This flexible WordPress solution allows you to apply a 5% surcharge to customer carts, with the ability to customize the percentage as needed, offering greater control over your e-commerce pricing.
/**
* Author: WP Turned UP
* Author URI: https://wpturnedup.com
*/
// ADD SURCHARGE % TO ALL WOOCOMMERCE ORDERS
add_action( 'woocommerce_cart_calculate_fees','woocommerce_custom_surcharge' );
function woocommerce_custom_surcharge() {
global $woocommerce;
if ( is_admin() && ! defined( 'DOING_AJAX' ) )
return;
$percentage = 0.05;
$surcharge = ( $woocommerce->cart->cart_contents_total + $woocommerce->cart->shipping_total ) * $percentage;
$woocommerce->cart->add_fee( 'Surcharge', $surcharge, true, '' );
}





