Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PLG-643]fix for new version of smart coupon plugin #359

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions includes/api/coupon-get.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,14 @@ function getCouponList($request)
// Cleanup cart.
WC()->cart->empty_cart();
create1ccCart($orderId);
$smartCoupon = new Wt_Smart_Coupon_Public(" ", " ");
$smartCoupon = new Wt_Smart_Coupon_Restriction_Public(" ", " ");

// Quantity of matching Products
$minMatchingProductQty = get_post_meta($coupon->get_id(), '_wt_min_matching_product_qty', true);
$maxMatchingProductQty = get_post_meta($coupon->get_id(), '_wt_max_matching_product_qty', true);

if ($minMatchingProductQty > 0 || $maxMatchingProductQty > 0) {
$quantityMatchingProduct = $smartCoupon->get_quantity_of_matching_product($coupon);
$quantityMatchingProduct = $smartCoupon->get_quantity_of_matching_product($coupon, [], []);
if ($minMatchingProductQty > 0 && $quantityMatchingProduct < $minMatchingProductQty) {
continue;
}
Expand All @@ -250,7 +250,7 @@ function getCouponList($request)
$maxMatchingProductSubtotal = get_post_meta($coupon->get_id(), '_wt_max_matching_product_subtotal', true);

if ($minMatchingProductSubtotal !== 0 || $maxMatchingProductSubtotal !== 0) {
$subtotalMatchingProduct = $smartCoupon->get_sub_total_of_matching_products($coupon);
$subtotalMatchingProduct = $smartCoupon->get_sub_total_of_matching_products($coupon, [], []);
if ($minMatchingProductSubtotal > 0 && $subtotalMatchingProduct < $minMatchingProductSubtotal) {
continue;
}
Expand Down