Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Only localize parameters for variable products
- if ( ! is_cart() ) {
- // Get the product
- $pro = get_product( $post );
- // Check if variable
- if ( $pro->product_type == 'variable' ) {
- // See what rules are being applied
- $rule_result = wpbo_get_applied_rule( $pro );
- // If the rule result is inactive, we're done
- if ( $rule_result == 'inactive' or $rule_result == null ) {
- return;
- // Get values for Override, Sitewide and Rule Controlled Products
- } else {
- $values = wpbo_get_value_from_rule( 'all', $pro, $rule_result );
- }
- // Check if the product is out of stock
- $stock = $pro->get_stock_quantity();
- // Check if the product is under stock management and out of stock
- if ( strlen( $stock ) != 0 and $stock <= 0 ) {
- if ( $values['min_oos'] != '' ) {
- $values['min_value'] = $values['min_oos'];
- }
- if ( $values['max_oos'] != '' ) {
- $values['max_value'] = $values['max_oos'];
- }
Add Comment
Please, Sign In to add comment