diff --git a/includes/class-wcqu-actions.php b/includes/class-wcqu-actions.php
index f96a610..86d5b8e 100755
--- 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-filters.php b/includes/class-wcqu-filters.php
index 47ce441..ca888eb 100755
--- 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-product-meta-box.php b/includes/class-wcqu-product-meta-box.php
index 18054d6..d745729 100755
--- 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',
diff --git a/includes/class-wcqu-product-unit.php b/includes/class-wcqu-product-unit.php
index b816971..a0ab460 100644
--- a/includes/class-wcqu-product-unit.php
+++ b/includes/class-wcqu-product-unit.php
@@ -61,7 +61,7 @@ public function get_unit_for_product( $product_id, $default = null ) {
*/
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' ) ) ) ) {
+ 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;
}
diff --git a/includes/class-wcqu-units-box.php b/includes/class-wcqu-units-box.php
index a62c83d..a160e43 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 );
}
diff --git a/includes/wcqu-functions.php b/includes/wcqu-functions.php
index e27ca32..8a73cc1 100755
--- 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
index eb85728..7b18f7e 100755
--- a/quantites-and-units.php
+++ b/quantites-and-units.php
@@ -196,10 +196,10 @@ 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' ) {
+ if ( $pro->get_type() == 'variable' ) {
// See what rules are being applied
$rule_result = wcqu_get_applied_rule( $pro );