Skip to content

Instantly share code, notes, and snippets.

View mstockton15's full-sized avatar

Merissa Stockton mstockton15

  • Oregon
View GitHub Profile
@mstockton15
mstockton15 / functions.php
Created January 18, 2019 21:10
Add Paypal surcharge/handling fee to Woocommerce cart / checkout
//Add Paypal 2.9%+0.50 surcharge to Woocommerce cart / checkout
function df_add_handling_fee( $cart_object ) {
global $woocommerce;
$spfee = 0.00; // initialize special fee
$spfeeperprod = 0.50; //special fee per product
$percentage = 0.029; //percentage
//Getting Cart Contents.
$cart = $woocommerce->cart->get_cart();
//Calculating Quantity