Last active
April 9, 2022 15:38
-
-
Save corsonr/6182904 to your computer and use it in GitHub Desktop.
WooCommerce - Add custom fee to cart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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' ); |
I got this working so that the fee is properly assessed and the customer pays the new total including the fee. I actually want to pass that fee on to the vendor. How would I go about adding that to the total they are able to withdraw?
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
how to make to choose value option from select list? :)