Error with product related coupon at the cart

Hello guys,

We created a coupon for a single product that has 100% discount. The problem is when the customer uses this coupon with this product at the cart and another one, because the system apply the 100% to all the products at the cart.

This configuration is standard, or is it a bug at Marketpress?

If is standard, why we can choose for a single product when create a new coupon? Is this correct?

The solution was to replace the lines`
if ( $coupon = $this->coupon_value($this->get_coupon_code(), $total) )
$total = $coupon['new_total'];`
by

foreach ($cart as $product_id => $variations) {
    foreach ($variations as $data) {
        $price = $this->coupon_value_product($coupon_code, $data['price'] * $data['quantity'], $product_id);
        $totals[] = $price;
        $product_count++;
    }
}
$total = array_sum($totals);
  • Vinod Dalvi
    • WP Unicorn

    Hi Danilo,

    Thanks for posting on the forum.

    I have tested it on my test site using latest version of MarketPress plugin and creating a 100% discount coupon. The coupon only applies to the specific product in the cart and not the all products which is expected. Please see the attached screenshot.

    Would you mind if I logged in to your site and did some troubleshooting? This might help get to the bottom of this faster. If this is ok, just grant me temporary admin access to your site by clicking "Grant Access" button in the WPMU DEV Dashboard Settings as described on the following page and reply on this thread after granting it?

    https://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    Kind Regards,
    Vinod Dalvi

  • Danilo
    • Flash Drive

    Hello Vinod Dalvi,

    Thanks for reply fast :slight_smile:

    I installed wordpress and the MarketPlace in its latest version. The problem happens when the completion of the purchase is made , note the sequence of prints .

    Problem in the last print.

  • Vinod Dalvi
    • WP Unicorn

    Hi Danilo,

    Thank you for your detailed reply.

    I could confirm the issue on my test site that the payment & order totals are displaying zero and payment type as 'N/A - Free order'. The same thing is displayed in the Order Confirmation email.

    I have notified the plugin developer about this issue so that it can be fixed.

    The issue will be fixed ASAP.

    Thanks,
    Vinod Dalvi

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.