Advertisement
wclovers

Untitled

Feb 18th, 2022
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.49 KB | None | 0 0
  1. add_filter( 'wcfmmp_free_shipping_minimum_order_amount', function( $min_amount, $vendor_id ) {
  2.     $line_subtotal = $line_total = 0;
  3.     foreach ( WC()->cart->get_cart() as $key => $item ) {
  4.         if( $vendor_id == wcfm_get_vendor_id_by_post( $item['product_id'] ) ) {
  5.             $line_subtotal += $item['line_subtotal'];
  6.             $line_total += $item['line_total'];
  7.         }
  8.     }
  9.     return ($min_amount > $line_subtotal) ? $min_amount - $line_subtotal + $line_total : 0;
  10. }, 999, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement