Mark-Tomlinson / markup-by-attribute-for-woocommerce

Price markup by attribute term for WooCommerce
GNU General Public License v3.0
3 stars 3 forks source link

Calculation of variations by package type attribute #23

Open sergioxdev opened 3 years ago

sergioxdev commented 3 years ago

Hi Mark congratulations for the excellent job done,

I have a question, suppose we have produced with whose base price 1 $, and we have the following attributes:

ex.

but if we analyze the result for the packages it is wrong it should be:

it is possible for each attribute to add the following options:

Thanks in advance for any suggestions Sergio

Mark-Tomlinson commented 2 years ago

Interesting suggestion. I've had other suggestions that an attribute act as a multiplier after the other attributes are calculated, and this is a different take on that.

Essentially, I'd add a checkbox to flag an attribute as a 'multiplier attribute'. If an item had that attribute, then all other markups would be calculated first and the total would be multiplied by the multiplier markup. '9' and '900%' are the same in this case, so it doesn't matter if a regular number or percentage is used. Partial quantities, like 0.5 (50%) or 1.33 (133%) would work as well. So, if an item came as a single unit or a six-pack for a reduced per-unit price, then the attribute might have 'Single' (for 100%) and 'Six-Pack' (for 540%).

My priority is to keep it simple, since the plugin is a hobby for me, and I'd rather not introduce features that raise support questions. This becomes an issue when someone adds two or more multiplier attributes, and then wonders why it isn't working -- it will happen.

If something like this meets your requirements, I'll take a look at the code and see what it will take to do it. Let me know.

sergioxdev commented 2 years ago

Hi Mark

in my opinion a solution could be, add the following select for each attribute: (normal - group - packs)

attribute 1 (normal - is added to the rest of the attributes) attribute 2 (group - is added to a group x, to then be multiplied by the number of packages) attribute 3 (group - is added to a group x, to then be multiplied by the number of packages) attribute 4 (packs - is multiplied with group x)

att_1 = 2 att_2 = 4 att_3 = 5 att_4 = 10 (att_1 + ((att_2 + att_3) att_4)) = (2 + ((4 + 5) 10)) = 92

if you want this selection it is possible to insert it, in the phase of creating the variations, when configuring the list price, in the same popup, when the value to be entered is requested, just display the attributes that contribute to the creation of the price, and for each of they show a select to select the type of behavior (normal - group - packages)

that way, it shouldn't compromise the plugin, and it's relatively simple

Mark-Tomlinson commented 2 years ago

If I make a change to the plug-in, I will probably add a checkbox to the attribute term page beneath the markup. Markup-by-Attribute already has a module for that page, so it would be a relatively simple change.

The trick would be to figure out how to process the multiplier attributes last. Markup-by-Attribute parses through the attributes assigned to each variation in the order that WooCommerce stores them. I can't change the order, so I would have to set multiplier attributes aside and process them when all other attributes are finished for that variation.

I've been looking into this. But, again, this is a hobby. It may be a few weeks before I have incorporated the change.

sergioxdev commented 2 years ago

Hi Mark

obviously I understand that you do it as a hobby, I am available to help you.