pcawilliams
Forum Replies Created
Viewing 4 replies - 1 through 4 (of 4 total)
-
Forum: Plugins
In reply to: [WooCommerce] Add Percentage as Fee for order over $5kI was able to figure it out.
The code below will add the cart, shipping and tax totals together and add a 3% fee if it is over $5,000.00
add_action('woocommerce_cart_calculate_fees', function() { if (is_admin() && !defined('DOING_AJAX')) { return; } $percentage = 0.03; // Percentage (3%) in float $percentage_fee = (WC()->cart->get_cart_contents_total() + WC()->cart->get_shipping_total() + WC()->cart->get_taxes_total()) * $percentage; $cart_total = (WC()->cart->get_cart_contents_total() + WC()->cart->get_shipping_total() + WC()->cart->get_taxes_total()); if ($cart_total > 5000) { WC()->cart->add_fee(__('A small fee for orders over $5,000.00', 'txtdomain'), $percentage_fee); } });- This reply was modified 4 years, 9 months ago by pcawilliams.
- This reply was modified 4 years, 9 months ago by pcawilliams.
Forum: Plugins
In reply to: [WooCommerce] Add Percentage as Fee for order over $5kI got this warning:
Don't Panic The code snippet you are trying to save produced a fatal error on line 73: is_readable(): open_basedir restriction in effect. File(/dev/urandom) is not within the allowed path(s): (/tmp:/home/pacificmarine.net/) The previous version of the snippet is unchanged, and the rest of this site should be functioning normally as before. Please use the back button in your browser to return to the previous page and try to fix the code error. If you prefer, you can close this page and discard the changes you just made. No changes will be made to this site.Thoughts?
Thank you for your response. I guess the support staff at our webhost needed that info to make the fix. Well, it looks like everything is in order now. Thank you so much!
Hello @erania-pinnera since posting this I actually did another fresh install and changed our site to a new subdirectory. Please see the following
Viewing 4 replies - 1 through 4 (of 4 total)