Skip to content

Commit

Permalink
Fixed errors re: get_product
Browse files Browse the repository at this point in the history
  • Loading branch information
Isabel committed Apr 28, 2017
1 parent 55a67a2 commit 3e20e74
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions woocommerce-max-quantity.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: WooCommerce Max Quantity
Plugin URI: https://isabelcastillo.com/free-plugins/woocommerce-max-quantity
Description: Set a limit for the max quantity of products that can be added to cart, per product. Now with individual product limits.
Version: 1.4.2
Version: 1.4.2.alpha.1
Author: Isabel Castillo
Author URI: https://isabelcastillo.com
License: GPL2
Expand Down Expand Up @@ -268,9 +268,9 @@ function isa_wc_max_qty_add_to_cart_validation( $passed, $product_id, $quantity,

global $woocommerce;
$already_in_cart = isa_wc_max_qty_get_cart_qty( $product_id );
$product = get_product( $product_id );
$product_title = $product->post->post_title;

$product = wc_get_product( $product_id );
$product_title = $product->get_title();
if ( ! empty( $already_in_cart ) ) {
// There was already a quantity of this item in cart prior to this addition.
// Check if the total of already_in_cart + current addition quantity is more than our max.
Expand Down

0 comments on commit 3e20e74

Please sign in to comment.