Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* ********************
- # Menambah Handling fee pada checkout page WooCommerce sesuai berat seluruh produk yang ada di cart.
- # Paste kode berikut pada file functions.php di WordPress.
- # lukman@activist.co.id
- ************************ */
- add_action( 'woocommerce_cart_calculate_fees','endo_handling_fee' );
- function endo_handling_fee() {
- global $woocommerce;
- $total_weight = $woocommerce->cart->cart_contents_weight;
- $total_weight .= ' '.get_option('woocommerce_weight_unit');
- $total_weight = ceil($total_weight); // Round to top
- if ( is_admin() && ! defined( 'DOING_AJAX' ) )
- return;
- $fee = 5000 * $total_weight; /* Ganti dengan nominal yang ingin digunakan */
- $woocommerce->cart->add_fee( 'Handling', $fee, true, 'standard' );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement