Guest User

Untitled

a guest
Dec 15th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. // Only localize parameters for variable products
  2. if ( ! is_cart() ) {
  3.  
  4. // Get the product
  5. $pro = get_product( $post );
  6.  
  7. // Check if variable
  8. if ( $pro->product_type == 'variable' ) {
  9.  
  10. // See what rules are being applied
  11. $rule_result = wpbo_get_applied_rule( $pro );
  12.  
  13. // If the rule result is inactive, we're done
  14. if ( $rule_result == 'inactive' or $rule_result == null ) {
  15. return;
  16.  
  17. // Get values for Override, Sitewide and Rule Controlled Products
  18. } else {
  19. $values = wpbo_get_value_from_rule( 'all', $pro, $rule_result );
  20. }
  21.  
  22. // Check if the product is out of stock
  23. $stock = $pro->get_stock_quantity();
  24.  
  25. // Check if the product is under stock management and out of stock
  26. if ( strlen( $stock ) != 0 and $stock <= 0 ) {
  27.  
  28. if ( $values['min_oos'] != '' ) {
  29. $values['min_value'] = $values['min_oos'];
  30. }
  31.  
  32. if ( $values['max_oos'] != '' ) {
  33. $values['max_value'] = $values['max_oos'];
  34. }
Add Comment
Please, Sign In to add comment