Skip Navigation

[Résolu] Split: Best Approach for WooCommerce Product child & grandchild post types – set commission rate

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:
Split: Best Approach for WooCommerce Product child & grandchild post types - set commission rate

Solution:
To calculate commission date you need custom shortcode.

You can find the proposed solution, in this case, with the following reply:
https://toolset.com/forums/topic/split-best-approach-for-woocommerce-product-child-grandchild-post-types-set-commission-rate/#post-1096143

Relevant Documentation:

This support ticket is created Il y a 6 années et 2 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Ce sujet contient 11 réponses, a 2 voix.

Dernière mise à jour par marcusC-4 Il y a 6 années et 2 mois.

Assisté par: Minesh.

Auteur
Publications
#1095632

Hey Minesh,

I have been able to setup the post types & have a custom field for Commissions, but I have 1 issue.

When I set the commission rate on the product editing page, it overrides the global value everywhere. What I need is to be able to set a custom commission rate on each product. For example, one person could sell 2 products and have 2 different commission rates.

Currently, if I change the commission rate in one place, it changes it everywhere.

#1095634

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

When I set the commission rate on the product editing page, it overrides the global value everywhere. What I need is to be able to set a custom commission rate on each product. For example, one person could sell 2 products and have 2 different commission rates.
==> I would like to know here how you want to setup your commission rate?
-- different commission rate Per product per Vendor?
- different commission rate per product only irrespective of vendor?

#1095637
setting-different-commissions-on-different-products-2.jpg
setting-different-commissions-on-different-products-1.jpg

I put my answers below in italics and marked with a single *
When I set the commission rate on the product editing page, it overrides the global value everywhere. What I need is to be able to set a custom commission rate on each product. For example, one person could sell 2 products and have 2 different commission rates.

==> I would like to know here how you want to setup your commission rate?
*I want to be able to set a different commission rate for the same vendor on different products. So, let’s say Apple is my vendor. I want to set a commission rate of 10% for them on one product and set a commission rate of 20% for them on another product.

-- different commission rate Per product per Vendor?
*Yes

- different commission rate per product only irrespective of vendor?
*I’m not sure what this means. Can you clarify?

I have attached 2 images that show the product editing screen, where I can change the commission rate for my vendors & sub-vendors. My challenge is that I need the commission rate to be tied only to that vendor (or sub-vendor) with that product.

#1095659

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Well - I need to check what relationship you create.

What if you create a many to many relationship between product and vendor and product and sub-vendor.

I think that will resolve the issue which will allow you to add commission (per product per vendor) and (per product per sub-vendor).

#1096070

Do you need access to the backend of the site?

The relationship between product & sub-vendor is already many-to-many. However, when I change the commission value for the sub-vendor on one product, it changes the commission value on every product.

It seems to me like the commission value should be stored as a custom field of the product instead of being a custom field of the sub-vendor. That way it can be unique for each product.

That being said, I don’t know how I would "connect" that custom field of the product so that we know which sub-vendor it applies to.

#1096087

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Yes - could you please share access details so I can check your setup first.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#1096143

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Well - when you create a many to many relationship - you can add the custom field to your intermediary post type.
=> lien caché

So, for example, if you visit able link - I've added one custom field "seller-product-commission" to your relationship "sellers-commission".

Now, whenever you try to add or Connect existing post for that relationship within "Seller Commision" relationship box:

From Product:
=> lien caché

OR

Form Seller Profile:
=> lien caché

it will offer you the filed to setup your % value using field "seller-product-commission" which we setup.

So commission value will always be available to setup per product, per seller profile. I hope this is clear.

The same should be happen with Company and Product relationship (manyToMany) if required. Please make sure you should understand the relationship between your entities or take expert advise on that before you setup.

I suggest you should understand how Many-To-Many relationship works:
=> https://toolset.com/documentation/post-relationships/how-to-set-up-post-relationships-using-toolset/#relationship-fields-in-many-to-many-relations

#1096661

Minesh,

I see what you mean -- that’s great!

I’ll need to use these commission rates to create reports that show how much commission has been earned by each Company & Seller each month.

Is that possible?

#1096869

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Well - to calculate commission you need the amount and commission % - correct? that means you need some processing using couple of fields - Its possible but it may need a little bit custom programming to calculate commission OR may need custom query as well to calculate exact commission by each Company & Seller each month.

I mean to say it may not be straight forward but should be possible.

#1098798

Understood. That’s great.

Could you point me in the direction of documentation on where I would find those values to create the reports? Will it just be querying in the new custom fields?

Thanks

#1099349

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

well - as said, you may need a custom shortcode to calculate your field values and its totally depends on your requirement.

To fetch related posts of post relationship - here is the PHP API:
=> => https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/

So, there is no such Docs available to build such custom code. If you need custom programming for your project, please feel free to contact our certified partners:
=> https://toolset.com/contractors/

However, here is the Doc that may help you:
=> https://toolset.com/documentation/customizing-sites-using-php/

#1100668

Ok, thanks for the info. We’ll try to implement the solution from here.