• Resolved janothemes

    (@janothemes)


    I want to be able to apply Admin coupon on cart, But it throw this exception
    This coupon is invalid for multiple vendors.

    If I comment out this line in “includes/order/Hooks.php”
    add_filter( ‘woocommerce_coupon_is_valid’, array( $this, ‘ensure_vendor_coupon’ ), 10, 3 ); ”

    Then it is fine. but as it is not permanent solution, as on plugin update i need to do it again.

    I tried this also in my child theme and in custom plugin. But still not working:
    add_filter( ‘dokan_ensure_vendor_coupon’, ‘__return_false’ );

    Is there any way i can remove this filter, So that coupon can be applied.

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Jahidul Hassan Mojumder

    (@jahidulhassan)

    Hi @janothemes,

    From your statement, I can understand you are using a fixed cart discount coupon. When you are using a fixed cart discount coupon on an order where there are two vendors, how much will be deducted from which vendor is not decided. This is why the fixed cart discount coupon does not work on an order that involves multiple vendors.

    If you use a percentage discount coupon then it will work. I believe the above-mentioned discussion explained why the filter is there. You can remove the filter using the remove_filter function from your child theme’s functions.php file.

    I hope the information will help. Thanks!

    Thread Starter janothemes

    (@janothemes)

    Thanks for the explanation.

    But if we still want to removed the filter.
    I already tried with remove_filter and tried again after you mentioned .

    add_action( 'init', 'bc_woocommerce_coupon_is_valid', 5);
    function bc_woocommerce_coupon_is_valid() {
       remove_filter( 'woocommerce_coupon_is_valid', ['Hooks', 'ensure_vendor_coupon'], 10);
    }

    Also tried this

    remove_filter( 'woocommerce_coupon_is_valid', ['WeDevs\Dokan\Order\Hooks', 'ensure_vendor_coupon']);

    But it is not working. Can you please tell me the correct code.

    Thanks

    • This reply was modified 3 years, 7 months ago by janothemes.
    Plugin Support Jahidul Hassan Mojumder

    (@jahidulhassan)

    Hi @janothemes,

    I investigated to piece of code a bit further and found that the hook was declared in the constructor function of the Hooks class. This is why if you want to remove that hook, then you will need to make changes in the core file.

    I tried to figure out a way to remove the filter from functions.php but as it is declared in the __construct function, it is unavailable to remove the filter using the functions.php file.

    Plugin Support Jahidul Hassan Mojumder

    (@jahidulhassan)

    Hi @janothemes,

    Due to inactivity, we are marking this topic as resolved. Feel free to open a new one if you face any further issues.

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Coupon for multiple vendors’ is closed to new replies.