Guest User

Untitled

a guest
Mar 21st, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. add_filter('wf_shipping_skip_product','skip_my_products',10,3);
  2.  
  3. function skip_my_products($skip = false, $product, $package){
  4. $shipping_class_goup = array('class-a','class-b'); // if these shipping classes coming together in the cart
  5. $shipping_class_skip = 'class-a'; // If multiple shipping class of above in the cart, skip this product.
  6.  
  7. $shipping_class = array();
  8. foreach ($package as $key => $item) {
  9. $shipping_class[] = $item['data']->get_shipping_class();
  10. }
  11.  
  12. if( $product['data']->get_shipping_class()==$shipping_class_skip && ( count( array_intersect( $shipping_class, $shipping_class_goup ) > 1 ) ) ){
  13. return true;
  14. }
  15. return false;
  16. }
Add Comment
Please, Sign In to add comment