Home › Forums › WC Vendors Free Support › Customising Commission (emails & backend)
NOTICE: We've Moved to a Ticket System for Support
As of August 31, 2017 (12am EST) our support forums will be retired (read-only), and we will be moving to a support ticket system. This will allow us to better organize and answer support requests, and provide a more personalized experience as we assist our customers.
For the time being, we will leave our forums open for reading and learning while we work on creating a more robust Knowledge Base for everyone to use.
If you are a WC Vendors Pro customer please open a support ticket here. If you are a WC Vendors user please open a support ticket on the Wordpress.org forums.
The information on this forum is outdated and in most instances no longer relevant. Please be sure to check our documentation for the most up to date information.
Thank you to all of our customers!
- This topic has 8 replies, 4 voices, and was last updated 7 years, 8 months ago by Anna.
-
AuthorPosts
-
July 11, 2016 at 1:15 pm #36838MattParticipant
Hi guys,
So I’m trying to do a couple of things. Firstly, I modified my functions.php to include a base rate of commission (£0.50) + a commission rate of 5%. The commission itself comes up fine in the backend Commissions dashboard (Woocommerce > Commission), but not in the email to the vendor. I tried copying vendor-new-order.php to my child theme, but I can’t find where to modify the table in the email – more specifically, the Commission, Tax and Shipping Subtotals (I’d also like to add a grand total received by vendor to this).
Secondly, I’d like to modify that function mentioned above to subtract the Paypal fees I incur (£0.20 + 3.4%), by using something like this:
add_filter( ‘wcv_commission_rate’, ‘my_wcv_commission_rate’, 10, 4 );
function my_wcv_commission_rate( $commission, $product_id, $product_price, $order ) {
$per_item_addition = .5; //add $0.50 charge for each item sold — Change to whatever $ amount you want!
$commission_rate = WCV_Commission::get_commission_rate( $product_id ); //get product specific rate
$commission = $product_price * ( $commission_rate / 100 ); //compute commission
$commission = round( $commission, 2 ) – $per_item_addition; //round and remove per item fee.
$commission = $commission – ( .2 + ( $product_price * .034 ) ); //subtract paypal fee.
if ( $commission < 0 ) $commission = 0; //set to 0 if less than 0
return $commission;
}…except I’d need that last $product_price to be the grand total variable (including shipping) rather than just the product price. What handle should I use instead?
Lastly, if at all possible, I’d like to change the commission values I see in the backend Woocommerce dashboard to be the amounts I actually need to send manually to each vendor (i.e. product price – commission + shipping). I thought that might be in reports.php, but it doesn’t appear so. Where can I go to change this?
Apologies for the rather involved request & thanks in advance for your help!
Cheers,
MattJuly 12, 2016 at 7:37 pm #36975WC Vendors SupportParticipantThe custom coding is all up to you. We are a team of two, no time in the day to review custom commission filters. 🙂
The commissions shown in wp-admin > Woo > Commissions are the actual commission values as the commission controller calculates them. If the numbers there disagree with what you were expecting, it would be something in your code in there.
Cheers
July 13, 2016 at 9:57 am #37039MattParticipantHi Ben,
Thanks for getting back to me so quickly. No problem, I can do much of that myself and I appreciate that you have your hands full (I know the feeling)! Although a nudge in the right direction with regards to the handle I should use in place of $product_price for the total cost (including shipping) would solve much of my issue.
Other than that, fantastic plugin and I’m sure we all appreciate the work you guys put in!
Cheers,
MattJuly 14, 2016 at 2:53 pm #37166WC Vendors SupportParticipant$product_price is an argument given to the function, and is independent of any shipping costs. Shipping calculations are a bit more complex, depending on how you do shipping. Likely checking the customers address vs how the meta keys are setup for shipping would be the way to go.
July 23, 2016 at 11:29 am #37999MattParticipantThanks for your help Ben. I gather you don’t do paid support tickets any longer? Apologies in advance for the long reply (PHP is very new to me)…
I will be moving to Pro soon (for various reasons), but I just want to make sure I’ll be able to solve this particular problem first if I do.
WCV Pro: “Multiple commission types such as percentage, percentage + fee, fixed fee, and even fixed fee + fee”. So what I’m trying to do is incorporate Paypal fees into the commission calculation; the problem being that these use the order total (not just the product price) so I need to get both the shipping total and the grand total for the order – I just can’t access them. I’m guessing I still won’t be able to do this in the Pro admin settings, right?
So here’s what I have for my commission calculation to illustrate (in my child theme’s functions.php):
add_filter( ‘wcv_commission_rate’, ‘my_wcv_commission_rate’, 10, 4 );
function my_wcv_commission_rate( $commission, $product_id, $product_price, $order ) {
$shipping_total = WC_Abstract_Order::calculate_shipping(); //get shipping total from order
$grand_total = WC_Abstract_Order::calculate_totals(); //get grand total from order
$commission_rate = WCV_Commission::get_commission_rate( $product_id ); //get product specific rate
$commission = $product_price * ( $commission_rate / 100 ); //compute commission
$per_item_addition = .5; //add £0.50 charge for each item sold — Change to whatever £ amount you want!
$commission = round( $commission, 2 ) – $per_item_addition; //round and remove per item fee.
$paypal_fee = .2 + ( .034 * $grand_total ); //paypal fees calculated on grand total, not product price
$commission = $commission – $paypal_fee; //subtract paypal fee.
$commission = $commission + $shipping_total; //add the shipping to commission due total
if ( $commission < 0 ) $commission = 0; //set to 0 if less than 0
return $commission;
}Then I get this error logged:
Using $this when not in object context in /…/public_html/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php on line 825Those first 2 lines in the function are the issue and I get that $this works on the object in play when calculate_shipping() and calculate_totals() are called from WC_Abstract_Order and that’s why it’s not working (since there’s no object?).
I know you guys are super busy, but it feels like this should be a quick-fix for someone that knows PHP. Is it? Do I need to declare anything as global or am I barking up the wrong tree? Thanks in advance – I appreciate all the help I can get! (I’d be pulling my hair out if I had any)
Cheers,
MattJuly 25, 2016 at 1:33 pm #38124WC Vendors SupportParticipantWe stopped offering paid support because we got too many requests for it. Not enough time in the world. 🙁 Gotta keep our focus on Pro, rather than making one site look good, we like to make them all look/work well! We usually recommend codeable.io for third party custom dev works. Never heard a complaint about them and they are all WooCommerce / WC Vendors Free/Pro certified.
For filters like that, you’ll always want to hard code teh commission values. Dont rely on functions to look up commission rates, the filters you’re using override them and they may not actually work. The filter is top dog. It overrides *everything*. Keep at it, you’ll get it working soon enough!
August 19, 2016 at 8:10 am #40526Joao de GoisParticipantHi Ben
I see that you no longer offer paid support. I have a few items that I need changed or added and ask if it will fall under a 3rd party support as you recommend or if its something that you will still support. I. sending another post with my request.
Regards
Joao de GoisAugust 19, 2016 at 8:15 am #40527Joao de GoisParticipantHi Ben
Here is the list of items I’m looking to implement. I’m busy with a portal for Art & Antique dealer to showcase their stock during fairs. Most of the dealers only sell items during fairs. In most cases there is only 1 item of each product. There is never any back orders. We won’t handle any selling for them nor any payment methods. We just charge a fee to have the products on the portal for the duration of the fair. http://www.livefairs.comDASHBOARD
Add link in menu bar of dashboard to logout.
Under the Dashboard menu have the following:
Loged in as: ?????
You have ??? products listed in your shop.Provide space for input text box or custom widget. This can be used to provide instruction to vendors or other information.
Ability to view own listing of products by ordered category. As follows; Name, Category, Price. (no images to be included). Be able to print this listing.
Remove/change the template ‘report overview’ from dashboard that shows; commission due/paid, orders, Product totals, recent orders.
PRODUCTS
Categories, show the full list to multi choose and not scroll down
Add a Click/Select button next to word of categories to deselect all categories
Remove option of Grouped product
Mandatory field for SKU
Under Inventory add option of SOLD so that it then shows in the page of sold items.
Ideally when marked as SOLD it would then add/move this product to the category of SOLD
Create a template page to show SOLD items but only displaying the item featured image, name, desciption and short description and vendor name.
SETTINGS
We rent out the portal for vendors to showcase their stock during the fairs. For each fair that we host we charge a fee to the vendor but vendors are not obliged to use the portal for very fair they partake in. I want to have the option to exclude certain vendors from the portal for certain fairs. This would be best done by having a listing of vendors and then choosing by multi select whcih vendors are on or off for the fair.
The vendor must still have the ability to administer their shop at all times.
VIEW STORE
The banner that shows on top of each store/vendor to have the ability to use a short code so that I can customise the way it appears on top. Ideally to include a photo of vendor plus the logo of vendor.
August 21, 2016 at 12:04 am #40623AnnaMember@joaodegois
First off- this is in the “free” forum, so I am assuming you are suing the free version of wc vendors.1. For the temporary access for a fee… search through the forums here for ideas form various users who have used paid memberships pro and woocommerce groups + groups to create membership access based upon a payment. https://www.wcvendors.com/help/topic/paid-membership-solution/ https://www.wcvendors.com/help/topic/monthly-subscriber/
Links: If you want to customize the links on the FREE vendors dashboard, the template is: wc-vendors/templates/dashboard/links.php You move that to your theme https://www.wcvendors.com/kb/changing-vendor-templates/ and add the links that you wish into the links.php in your theme or child theme.
Text you can add by editing the templates.. which one depends on where you want it. Play with the templates on a dev or staging site, or local dev environment..Some of the other requests you have made for the dashboard will most certainly require a lot of custom coding.
Some of the options you mentioned— like removing grouped products, multi-select, etc are in the PRO version of wc vendors.
You can also make fields mandatory in PRO using code, and some are done with settings in the admin.
You can customize the banner in either free or PRO with css and by adding code. For FREE, its the vendor-main-header.php template.
Honestly PRO is much more customizable. But for some of this work you may want to contact a dev at codeable.io to get a quote (Whatever it is you want to do with SOLD products..) . Quite a few of your needs can be met with some minor customization– some are already available in PRO.
If you’re going to go through the cost and effort for these customizations.. I would recommend you at least upgrade to PRO first, and see what is already available in PRO and then go from there.
-
AuthorPosts
- The forum ‘WC Vendors Free Support’ is closed to new topics and replies.