We created a custom Cartthrob plugin which applies a 10% discount to items in the cart if purchased before a certain date, which works fine.

But we also have a coupon code to give 10% off.

Coupons and discounts are "not to be used with with any other offer". It means if someone enters the coupon code, the our custom discount should not be applied.

I can't find any help on this and wondered if anyone has a suggestion/solution?


1 Answer 1


Have possibly found a solution, by retrieving the cart data direct from the database, decrypting and unserialising it I can obtain the cart data and see coupon codes applied, so am able to check against this.

private function _getCart($cart_id)

    $query = ee()->db->select('cart')
        ->from('exp_cartthrob_cart ctc')
        ->where('ctc.id = "'.$cart_id.'"')

    if ($query->num_rows() > 0)
        $fields[] = '';
        foreach ($query->result_array() as $row)
            $cart = unserialize($this->EE->encrypt->decode($row['cart']));

    return $cart;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.