Vendor Commission Not Calculated Correctly with Membership and Admin Coupon

MultivendorX Pro

Open
Viewing 6 reply threads
  • Author
    Posts
    • #204113
      Justin Harrison
      Participant

      Hi Support, I am having an issue with commissions being calculated properly when an admin coupon is used with vendor products under a membership. I have tested the scenario of identical products with 2 different vendors – one on a membership with an 86% commission, one not on a membership with an 86% commission. I apply an admin created coupon of 10% discount to orders where each contains a single $100 product from the two separate vendors. The end result is a commission of $86 for the non-membership vendor (that is the correct amount which is 86% of $100) and a commission of $77.40 for the membership vendor (that is the incorrect amount which is 86% of $90 which means the commission is calculated after the coupon is applied). Coupons are configured to be on the vendor except when created by the admin. That is indeed working correctly on non-membership vendors, just not on vendors with a membership.

      Here is a video documenting this on a test site with everything updated and the only plugins active are MultivendorX, MultivendorX Pro, WooCommerce, My Private Site (to keep private), and User Switching (to allow to jump between admin and vendor): https://www.loom.com/share/01ac8a00cfe24f17974ea017c2b747d9?sid=cbc2a514-7b56-4d64-ae31-b3d50993cf31

      Please let me know if you have any questions or how I can help resolve this bug.

    • #204114
      Justin Harrison
      Participant

      As a quick follow up after digging into the code, it looks like the Membership module does not have the following lines in the commission calculation function but this code is from the standard commission calculation function in MultivendorX which would explain the different results during my testing (it doesn’t account for the admin_coupon_excluded setting):

      if ($MVX->vendor_caps->vendor_payment_settings(‘admin_coupon_excluded’) && !$order_counpon_author_is_vendor) {
      $line_total = $order->get_item_subtotal($item, false, false) * $item[‘qty’];
      }

    • #204115
      Justin Harrison
      Participant

      Sorry for blowing up this support ticket, but also realized the $order_counpon_author_is_vendor variable was being set above it too and was left out of the Membership module code:

      // Check order coupon created by vendor or not
      $order_counpon_author_is_vendor = false;
      if ($order->get_coupon_codes()) {
      foreach( $order->get_coupon_codes() as $coupon_code ) {
      $coupon = new WC_Coupon($coupon_code);
      $order_counpon_author_is_vendor = $coupon && is_user_mvx_vendor( get_post_field ( ‘post_author’, $coupon->get_id() ) ) ? true : false;
      }
      }

    • #204140

      Hello @Justin Harrison. Thanks for informing and explaining this to us.
      I have informed the dev team and we will add a fix for this in our next update.

    • #204163
      Justin Harrison
      Participant

      Thank you. I did make the code change in my dev environment to confirm that adding the code above to the Membership module did fix the commission issue and it did.

    • #204173

      @Justin Harrison Thank you very much for keeping us updated about this. We will add a fix for the issue in our next MultiVendorX Pro update.

    • #219204

      We have added a fix for this issue in our latest update. Kindly update the MultiVendorX Pro plugin to it’s latest version and check.

Viewing 6 reply threads

Please LOGIN to reply to this topic