Vivek Athalye
Forum Replies Created
-
@dualcube Ok. I’ll take a look at WCMp Advance Shipping code and let you know if I have further queries.
Hi @itzmekhokan, thanks for explaining this. I know that in
wcmp_vendor_orders
there will be N rows, one for each item in a given order.My question is more about Commission ID, that refers to the commission entry in
wp_posts
table (post type:dc_commission
). Can I assume that there will be only one commission ID for the given order (assuming all items are from same vendor).For some reasons I can’t use Table Rate Shipping.
I’m using https://www.ads-software.com/plugins/weight-based-shipping-for-woocommerce/. This serves the purpose but it doesn’t show up for vendors.
No. I don’t want to show all vendors’ commission together.
My question is:
Is there any scenario when there could be multiple commission records for given order id + vendor id combination?For simplicity lets assume that the order has all the items from single vendor. In this case is there any possibility that there could be multiple commission records?
Forum: Plugins
In reply to: [WooCommerce] Wrong sorting order of orders in WOO/OrdersI also see the orders in random order. I know I can click on the order column to sort them by ID. But how do I make it the default. So whenever I land on
wp-admin/edit.php?post_type=shop_order
the list of orders should show the latest order at top.
I shouldn’t need to click on the order column.yes you can do the above to get item wise shipping and taxes.
Fine, then I’ll go ahead with the approach described earlier.
if you do some changes on shipping amount as well as taxes only then you need to call update query
Oh Ok.
Thank you ??
Ok. I’m trying to use
vendor_commission_amount
filter. As I can see the filter gets executed for each order item.
So the logic that I’ll need to implement is find out the shipping charges for current item and calculate the admin fee (10%) for this shipping charges. Then subtract this admin fee from the$amount
.
The filter doesn’t pass item specific shipping charges. So I used
$wpdb->get_results("SELECT shipping from {$wpdb->prefix}wcmp_vendor_orders WHERE order_id =" . $order_id . " AND order_item_id = " . $item_id . " AND product_id = " . $product_id);
to get the shipping charges for current order item.
Is this the right way? Or is there any alternative and better way?Btw, when I changed and returned the commission
$amount
the value got reflected in{$wpdb->prefix}wcmp_vendor_orders
table. I didn’t need to update it explicitly.@itzmekhokan Can you please elaborate which hook/filter should I use to adjust the commission value?
I tried using following code:
add_action('wcmp_vendor_commission_created', 'vna_subtract_admin_fee_from_shipping_charges'); function vna_subtract_admin_fee_from_shipping_charges($commission_id) { $shipping = get_post_meta($commission_id, '_shipping', true); $shipping *= 0.9; update_post_meta($commission_id, '_shipping', $shipping); }
But it only updates the value in post meta and doesn’t change the value in
wp_wcmp_vendor_orders
table.I can think of a possible workaround (conceptual) as follows:
The option ‘Transfer shipping charges collected (per product) to the vendor.’ should be unchecked, so that the shipping charges are credited to site admin.
Now, when the order status is set to completed, create a new commission entry that is based on the shipping charges of that order (or order item to be specific?) like commission = shipping charges – admin fee. In this case the item price should not be considered for calculating commission because the commission based on item price would have been already calculated and stored.I’m not sure if this is possible because:
1. Can we have multiple commission entries associated with one order?
2. How do I create WCMp_Commission entry?Any thoughts?
@dualcube I haven’t received any update on GitHub yet.
The text formatting was lost in above post. So here is the screen shot of the examples:
https://prntscr.com/mdb60qNot sure if you are getting my requirement. I’ll try to explain it again with couple of examples.
Lets say I’m a seller from MH. I want to apply following shipping rates based on shipping address (specifically State) as follows:
(Assuming Shipping Method is Flat Rate in all examples)
Shipping Address Rate
MH 50
DD, GJ, MP, TG, KA, GA 100
Rest of the states 150There could be another seller from say KA who wants to apply following shipping rates:
Shipping Address Rate
KA 60
Rest of the states 120Another seller from say MP wants to apply following shipping rates:
Shipping Address Rate
MP 45
GJ, MH 90
RJ, UP, CT 135
Rest of the states 180There could be any such combinations. How do you propose to handle these?
To handle any such cases, I’ve defined 1 shipping zone for each state and union territory, and 1 for India. So there are total 37 (29 + 7 + 1) shipping zones.
Based on the current implementation of WCMP, each seller needs to define shipping method for each of the states and UTs, that is: each seller needs to define shipping method 36 times (29 states + 7 UTs).
With the code change that I’ve submitted, sellers from above examples:
Seller from MH will need to define shipping methods for: MH, DD, GJ, MP, TG, KA, GA & India (only 8 times)
Seller from KA will need to define shipping methods for: KA & India (only 2 times)
Seller from MP will need to define shipping methods for: MP, GJ, MH, RJ, UP, CT & India (only 7 times)That saves lot of efforts for the sellers. Tomorrow if there is any change in their shipping rates then also, its much easier to handle those changes with above implementation.
Does that make sense now?
Btw, you mentioned:
each zone should have its own shipping method assigned
My code change specifically removes this restriction.
Then vendor can select for which zone they want to sell the product.
Actually my requirement is that even if the vendors want to sell to a particular zone (state – such as MH, GJ, KA, MP, WB etc), they may not want to define shipping method (rates) for that state. Instead they may want to use the rates defined for country India (another zone).
I’ve created a pull request for this requirement –
https://github.com/dualcube/dc-woocommerce-multi-vendor/pull/50Please check and let me know your thoughts.
Sorry for a late reply.
1. You had mentioned in your first response to this topic that
we will also let vendor enable/disable shipping zones, shipping method etc.
. I can see that enable/disable shipping methods functionality is there, but I could not find similar functionality for shipping zones. That is needed to resolve my original request.
2. Suggestion: When the vendor adds a shipping method, automatically open Edit Shipping Method dialog for this newly added method. Right now, vendor needs to explicitly click on Edit action after adding new shipping method.
3. Suggestion: I don’t see any need for ‘Save Options’ button in Store Settings > Shipping area (@ right top of the screen). If that’s correct, please remove it.Gr8. I’ll take a look and let you know if I’ve any queries. Thanks for the update.