Jump to content

separating product commissions & delivery costs

Recommended Posts

Hmm, the download link doesn't work for the zip, I'm getting a 404. Could you update?

However i think we have this plugin, isn't it the one where you enter the agent folder URL and the ID + code ?

Where would we do the whole "minus the shipping from the total gross, before adding commission values to agents" thing? Is that in this plug-in?

Link to post
Share on other sites

Thanks for the reply, I've had a look inside the plug-in's file and have found the jrox_generate_commission function. Inside there's a $total value with the value from the '_order_total' meta key.

Where is '_order_total' coming from? I looked through the WooCommerce code documentation but found no reference of it, I was wondering if there is a key such as '_order_shipping_total' maybe? As the shipping will vary in price dependent on the users location.

I'm guessing it's going to be a case of taking the shipping value from the $total before running file_get_contents?

Any help on this subject would be great! Thanks again :D

Link to post
Share on other sites


Yeah got that, it's from WooC. and that gets transfered into the JAM system later.

I just can't seem to find the metakeys, I've looked into the documentation but can't see a specific list of the keys.

I've found a calculate_shipping function in the Docs, I'm thinking of using that to calculate the shipping of the current product, is there a value in the plugins file that refers to the purchased products ID or something similar?

Link to post
Share on other sites

We've got it working! I didn't realise there was an _order_shipping key inside $wpdb. I've customized the plug-in, adding a new select field on the dashboard panel that controls whether the shipping is included or excluded: http://www.codeshare.io/jru4l


If you find it works well I'd be more than happy for you to apply to the JAM plug-in.

There is one problem however, our site is multi-currency, and when we order in EUR at the moment, the total appears in 2 different values on the same page see screenshot:


Could you have a look over the code maybe there's something to fix up (around line 131)?


Link to post
Share on other sites

Hi yes, that's what I was thinking. However I tried not to modify the $total value as I thought that could mess things up, but still the Total: is changing.

Could you check the modified plug-in file I sent in previous post? It's only a small customization around line 131, also, this happens both when $checkShipping is 1 and when it's 0 - so not related to that...

Link to post
Share on other sites

where are you getting the $total and $shipping variables from your code:


$checkShipping = get_option('jrox_woo_exship');
if ($checkShipping == '1') {
$jroxTotal = $total - $shipping;
} else {
$jroxTotal = $total;


the $total is explicitly set to zero, but the $shipping comes from nowhere..

also, when you deactivate the plugin, does it show the amounts correctly? If you use the default plugin with no customizations, does it show the amount correctly?

Link to post
Share on other sites
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...