WordPress.org

Plugin Directory

Changeset 1706166


Ignore:
Timestamp:
08/01/17 08:34:23 (6 months ago)
Author:
applyke
Message:

Fixed issue with variable products

Location:
woo-personal-discount/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • woo-personal-discount/trunk/readme.txt

    r1704202 r1706166  
    55Requires at least: 4.8 
    66Tested up to: 4.8 
    7 Stable tag: 1.0.0 
     7Stable tag: 1.0.1 
    88License: GPLv2 
    99License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
     
    5252* Initial release 
    5353 
     54= 1.0.1 = 
     55* Fixed issue with variable products 
     56 
    5457== Upgrade Notice == 
    5558 
    5659= 1.0.0 = 
    5760This is the first stable version. 
     61 
     62= 1.0.1 = 
     63Made changes in aplk_pd_woocommerce_custom_total() function, replaced calling wc_get_product_ids_on_sale() with comparing $product_data['sale_price'] and $product_data['price']. 
  • woo-personal-discount/trunk/woocommerce-personal-discount.php

    r1704202 r1706166  
    33Plugin Name: WooCommerce Personal Discount 
    44Description: Personal discount for customer in WooCommerce. 
    5 Version:   1.0.0 
     5Version:   1.0.1 
    66Author: Applyke 
    77Author URI: https://applyke.com 
     
    105105    $discount = $current_user->discount; 
    106106    if (!empty($discount)) { 
    107         $products_on_sale = wc_get_product_ids_on_sale(); 
    108107        if (!empty($woocommerce->cart->get_cart())) { 
    109108            $discount_total = 0; 
    110109            foreach ($woocommerce->cart->get_cart() as $product) { 
    111                 if (is_array($products_on_sale) && !in_array($product['product_id'], $products_on_sale)) { 
     110                $product_data = $product['data']->get_data(); 
     111                if (!isset($product_data['sale_price']) || $product_data['sale_price'] != $product_data['price']) { 
    112112                    if ($product['line_total'] != 0) { 
    113113                        $discount_total += (-$product['line_total'] * $discount / 100); 
Note: See TracChangeset for help on using the changeset viewer.