diff --git a/LICENSE b/LICENSE
old mode 100755
new mode 100644
diff --git a/includes/class-wcqu-actions.php b/includes/class-wcqu-actions.php
old mode 100755
new mode 100644
index f96a610..86d5b8e
--- a/includes/class-wcqu-actions.php
+++ b/includes/class-wcqu-actions.php
@@ -69,7 +69,7 @@ public function display_minimum_quantity_note() {
return;
}
- if( $product->product_type == 'grouped' )
+ if( $product->get_type() == 'grouped' )
return;
$settings = get_option( 'ipq_options' );
diff --git a/includes/class-wcqu-advanced-rules.php b/includes/class-wcqu-advanced-rules.php
old mode 100755
new mode 100644
diff --git a/includes/class-wcqu-filters.php b/includes/class-wcqu-filters.php
old mode 100755
new mode 100644
index 47ce441..ca888eb
--- a/includes/class-wcqu-filters.php
+++ b/includes/class-wcqu-filters.php
@@ -31,7 +31,7 @@ public function __construct() {
*/
public function woocommerce_loop_add_to_cart_args( $args, $product ) {
// Return Defaults if it isn't a simple product
- if( $product->product_type != 'simple' ) {
+ if( $product->get_type() != 'simple' ) {
return $args;
}
@@ -68,7 +68,7 @@ public function woocommerce_loop_add_to_cart_args( $args, $product ) {
public function input_min_value( $default, $product ) {
// Return Defaults if it isn't a simple product
- if( $product->product_type != 'simple' ) {
+ if( $product->get_type() != 'simple' ) {
return $default;
}
@@ -98,7 +98,7 @@ public function input_min_value( $default, $product ) {
public function input_max_value( $default, $product ) {
// Return Defaults if it isn't a simple product
- if( $product->product_type != 'simple' ) {
+ if( $product->get_type() != 'simple' ) {
return $default;
}
@@ -128,7 +128,7 @@ public function input_max_value( $default, $product ) {
public function input_step_value( $default, $product ) {
// Return Defaults if it isn't a simple product
- if( $product->product_type != 'simple' ) {
+ if( $product->get_type() != 'simple' ) {
return $default;
}
@@ -160,7 +160,7 @@ public function input_set_all_values( $args, $product ) {
// Return Defaults if it isn't a simple product
/* Commented out to allow for grouped and variable products
* on their product pages
- if( $product->product_type != 'simple' ) {
+ if( $product->get_type() != 'simple' ) {
return $args;
}
*/
diff --git a/includes/class-wcqu-post-type.php b/includes/class-wcqu-post-type.php
old mode 100755
new mode 100644
diff --git a/includes/class-wcqu-product-meta-box.php b/includes/class-wcqu-product-meta-box.php
old mode 100755
new mode 100644
index 18054d6..1b3c808
--- a/includes/class-wcqu-product-meta-box.php
+++ b/includes/class-wcqu-product-meta-box.php
@@ -19,10 +19,10 @@ public function meta_box_create() {
if ( $post->post_type == 'product' ) {
- $product = get_product( $post->ID );
+ $product = wc_get_product( $post->ID );
$unsupported_product_types = array( 'external', 'grouped' );
- if ( ! in_array( $product->product_type, $unsupported_product_types ) ) {
+ if ( ! in_array( $product->get_type(), $unsupported_product_types ) ) {
add_meta_box(
'wpbo_product_info',
@@ -30,7 +30,7 @@ public function meta_box_create() {
array( $this, 'product_meta_box_content' ),
'product',
'normal',
- 'high'
+ 'low'
);
}
}
diff --git a/includes/class-wcqu-product-unit.php b/includes/class-wcqu-product-unit.php
index b816971..d9ac998 100644
--- a/includes/class-wcqu-product-unit.php
+++ b/includes/class-wcqu-product-unit.php
@@ -60,8 +60,8 @@ public function get_unit_for_product( $product_id, $default = null ) {
* @return string
*/
public function get_price_suffix( $price_display_suffix, $product ) {
- // todo make default unit configuarble
- if ( $unit = $this->get_unit_for_product( $product->id, apply_filters( 'wciu_default_price_suffix', __( '', 'woocommerce' ) ) ) ) {
+ // todo make default unit configurable
+ if ( $unit = $this->get_unit_for_product( $product->get_id(), apply_filters( 'wciu_default_price_suffix', __( '', 'woocommerce' ) ) ) ) {
$price_display_suffix = "/" . $unit . " " . $price_display_suffix;
}
@@ -77,7 +77,7 @@ public function get_price_suffix( $price_display_suffix, $product ) {
* @return string
*/
public function sale_price_from_to( $price, $from, $to, $product ) {
- if ( $unit = get_post_meta( $product->id, 'unit', true ) ) {
+ if ( $unit = get_post_meta( $product->get_id(), 'unit', true ) ) {
$price = '' . ( ( is_numeric( $from ) ) ? wc_price( $from ) : $from ) . '/' . $unit . ' ' . ( ( is_numeric( $to ) ) ? wc_price( $to ) : $to ) . '/' . $unit . '';
}
@@ -91,7 +91,7 @@ public function sale_price_from_to( $price, $from, $to, $product ) {
* @return string
*/
public function price_html( $html, $product ) {
- $unit = get_post_meta( $product->id, 'unit', true );
+ $unit = get_post_meta( $product->get_id(), 'unit', true );
if ( $unit ) {
return $html . '/' . $unit;
}
@@ -109,4 +109,4 @@ public function add_order_item_meta( $item_id, $values ) {
endif;
-return new WC_Quantities_and_Units_Product_Unit();
\ No newline at end of file
+return new WC_Quantities_and_Units_Product_Unit();
diff --git a/includes/class-wcqu-units-box.php b/includes/class-wcqu-units-box.php
index a62c83d..cd88833 100644
--- a/includes/class-wcqu-units-box.php
+++ b/includes/class-wcqu-units-box.php
@@ -5,7 +5,7 @@
class WC_Quantities_and_Units_Units_Box {
public function __construct() {
- add_action( 'woocommerce_product_write_panels', array( $this, 'units_box_create' ) );
+ add_action( 'woocommerce_product_data_panels', array( $this, 'units_box_create' ) );
add_action( 'save_post', array( $this, 'save_unit_meta_data' ) );
add_action( 'woocommerce_product_write_panel_tabs', array($this, 'units_box_tab'), 99 );
}
@@ -66,4 +66,4 @@ public function save_unit_meta_data( $post_id ) {
endif;
-return new WC_Quantities_and_Units_Units_Box();
\ No newline at end of file
+return new WC_Quantities_and_Units_Units_Box();
diff --git a/includes/class-wcqu-validations.php b/includes/class-wcqu-validations.php
old mode 100755
new mode 100644
index caa7e2e..a45206e
--- a/includes/class-wcqu-validations.php
+++ b/includes/class-wcqu-validations.php
@@ -151,7 +151,7 @@ public function validate_single_product( $passed, $product_id, $quantity, $from_
// Get Cart Quantity for the product
foreach( $woocommerce->cart->get_cart() as $cart_item_key => $values ) {
$_product = $values['data'];
- if( $product_id == $_product->id ) {
+ if( $product_id == $_product->get_id() ) {
$cart_qty = $values['quantity'];
}
}
diff --git a/includes/wcqu-functions.php b/includes/wcqu-functions.php
old mode 100755
new mode 100644
index e27ca32..8a73cc1
--- a/includes/wcqu-functions.php
+++ b/includes/wcqu-functions.php
@@ -13,10 +13,10 @@ function wcqu_get_applied_rule( $product, $role = null ) {
// Check for site wide rule
$options = get_option( 'ipq_options' );
- if ( get_post_meta( $product->id, '_wpbo_deactive', true ) == 'on' ) {
+ if ( get_post_meta( $product->get_id(), '_wpbo_deactive', true ) == 'on' ) {
return 'inactive';
- } elseif ( get_post_meta( $product->id, '_wpbo_override', true ) == 'on' ) {
+ } elseif ( get_post_meta( $product->get_id(), '_wpbo_override', true ) == 'on' ) {
return 'override';
} elseif ( isset( $options['ipq_site_rule_active'] ) and $options['ipq_site_rule_active'] == 'on' ) {
@@ -38,8 +38,8 @@ function wcqu_get_applied_rule( $product, $role = null ) {
function wcqu_get_applied_rule_obj( $product, $role = null ) {
// Get Product Terms
- $product_cats = wp_get_post_terms( $product->id, 'product_cat' );
- $product_tags = wp_get_post_terms( $product->id, 'product_tag' );
+ $product_cats = wp_get_post_terms( $product->get_id(), 'product_cat' );
+ $product_tags = wp_get_post_terms( $product->get_id(), 'product_tag' );
// Get role if not passed
if(!is_user_logged_in()) {
@@ -178,13 +178,13 @@ function wcqu_get_value_from_rule( $type, $product, $rule ) {
// Return Out of Stock values if they exist
switch ( $type ) {
case 'min':
- $min_oos = get_post_meta( $product->id, '_wpbo_minimum_oos', true );
+ $min_oos = get_post_meta( $product->get_id(), '_wpbo_minimum_oos', true );
if ( $min_oos != '' )
return $min_oos;
break;
case 'max':
- $max_oos = get_post_meta( $product->id, '_wpbo_maximum_oos', true );
+ $max_oos = get_post_meta( $product->get_id(), '_wpbo_maximum_oos', true );
if ( $max_oos != '' )
return $max_oos;
break;
@@ -195,31 +195,31 @@ function wcqu_get_value_from_rule( $type, $product, $rule ) {
switch ( $type ) {
case 'all':
return array(
- 'min_value' => get_post_meta( $product->id, '_wpbo_minimum', true ),
- 'max_value' => get_post_meta( $product->id, '_wpbo_maximum', true ),
- 'step' => get_post_meta( $product->id, '_wpbo_step', true ),
- 'min_oos' => get_post_meta( $product->id, '_wpbo_minimum_oos', true ),
- 'max_oos' => get_post_meta( $product->id, '_wpbo_maximum_oos', true ),
+ 'min_value' => get_post_meta( $product->get_id(), '_wpbo_minimum', true ),
+ 'max_value' => get_post_meta( $product->get_id(), '_wpbo_maximum', true ),
+ 'step' => get_post_meta( $product->get_id(), '_wpbo_step', true ),
+ 'min_oos' => get_post_meta( $product->get_id(), '_wpbo_minimum_oos', true ),
+ 'max_oos' => get_post_meta( $product->get_id(), '_wpbo_maximum_oos', true ),
);
break;
case 'min':
- return get_post_meta( $product->id, '_wpbo_minimum', true );
+ return get_post_meta( $product->get_id(), '_wpbo_minimum', true );
break;
case 'max':
- return get_post_meta( $product->id, '_wpbo_maximum', true );
+ return get_post_meta( $product->get_id(), '_wpbo_maximum', true );
break;
case 'step':
- return get_post_meta( $product->id, '_wpbo_step', true );
+ return get_post_meta( $product->get_id(), '_wpbo_step', true );
break;
case 'min_oos':
- return get_post_meta( $product->id, '_wpbo_minimum_oos', true );
+ return get_post_meta( $product->get_id(), '_wpbo_minimum_oos', true );
break;
case 'max_oos':
- return get_post_meta( $product->id, '_wpbo_maximum_oos', true );
+ return get_post_meta( $product->get_id(), '_wpbo_maximum_oos', true );
break;
case 'priority':
diff --git a/quantites-and-units.php b/quantites-and-units.php
old mode 100755
new mode 100644
index eb85728..a56a3bf
--- a/quantites-and-units.php
+++ b/quantites-and-units.php
@@ -196,7 +196,7 @@ public function input_value_validation() {
if ( ! is_cart() ) {
// Get the product
- $pro = get_product( $post );
+ $pro = wc_get_product( $post );
// Check if variable
if ( $pro->product_type == 'variable' ) {
diff --git a/readme.txt b/readme.txt
old mode 100755
new mode 100644
diff --git a/screenshot-1.png b/screenshot-1.png
old mode 100755
new mode 100644
diff --git a/screenshot-2.png b/screenshot-2.png
old mode 100755
new mode 100644
diff --git a/screenshot-3.png b/screenshot-3.png
old mode 100755
new mode 100644
diff --git a/screenshot-4.png b/screenshot-4.png
old mode 100755
new mode 100644
diff --git a/screenshot-5.png b/screenshot-5.png
old mode 100755
new mode 100644
diff --git a/screenshot-6.png b/screenshot-6.png
old mode 100755
new mode 100644