diff --git a/includes/class-wcqu-actions.php b/includes/class-wcqu-actions.php
index f96a610..82ac2c5 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->is_type( 'grouped' ) )
return;
$settings = get_option( 'ipq_options' );
diff --git a/includes/class-wcqu-filters.php b/includes/class-wcqu-filters.php
index 47ce441..6e791e3 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->is_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->is_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->is_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->is_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->is_type( 'simple' ) ) {
return $args;
}
*/
diff --git a/includes/class-wcqu-product-meta-box.php b/includes/class-wcqu-product-meta-box.php
index 18054d6..148fd13 100755
--- a/includes/class-wcqu-product-meta-box.php
+++ b/includes/class-wcqu-product-meta-box.php
@@ -15,14 +15,14 @@ public function __construct() {
* Register Rule Meta Box for Product Page for all but external products
*/
public function meta_box_create() {
- global $post, $woocommerce;
+ global $post;
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 ( ! $product->is_type( $unsupported_product_types ) ) {
add_meta_box(
'wpbo_product_info',
@@ -41,7 +41,6 @@ public function meta_box_create() {
*/
function product_meta_box_content( $post ) {
global $product;
- global $woocommerce;
global $wp_roles;
// Get the product and see what rules are being applied
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..bf34dbd 100644
--- a/includes/class-wcqu-units-box.php
+++ b/includes/class-wcqu-units-box.php
@@ -5,13 +5,13 @@
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 );
}
function units_box_tab() {
- echo '