Advertisement
Guest User

Untitled

a guest
Jul 1st, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <?php
  2. /* ********************
  3. # Menambah Handling fee pada checkout page WooCommerce sesuai berat seluruh produk yang ada di cart.
  4. # Paste kode berikut pada file functions.php di WordPress.
  5.  
  6. # lukman@activist.co.id
  7. ************************ */
  8.  
  9. add_action( 'woocommerce_cart_calculate_fees','endo_handling_fee' );
  10. function endo_handling_fee() {
  11. global $woocommerce;
  12. $total_weight = $woocommerce->cart->cart_contents_weight;
  13. $total_weight .= ' '.get_option('woocommerce_weight_unit');
  14. $total_weight = ceil($total_weight); // Round to top
  15. if ( is_admin() && ! defined( 'DOING_AJAX' ) )
  16. return;
  17.  
  18. $fee = 5000 * $total_weight; /* Ganti dengan nominal yang ingin digunakan */
  19. $woocommerce->cart->add_fee( 'Handling', $fee, true, 'standard' );
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement