0

I think this is more a theoretical question, because I cannot find anyone online who has did this before.

Our customer is selling gravel and sand in bags and in bulk with the truck.

So I have the following attributes:

Quantity: 0,5 m³, 0,7 m³ and 1 m³ (3 options)

Quantity bulk: 10 ton, 11 ton, 12 ton ---- (a list to 35 ton, 25 options total)

Size: 8 - 16 mm, 14 - 20 mm (etc. 5 options)

As you can see, I want to combine the Quantity and the Quantity bulk variations..... but I do I want to display them differently in the frontend. The bulk options in a list, and the quantity options as checkboxes.

See a visual here:

size-quantity-design

I want to display them on my website just like I listed them, however the Quantity and the Quantity bulk options belong to each other, so I cannot create them as separated attributes in WooCommerce. This is because you do not combine all three attributes with each other. (so, no Size, Quantity and Quantity bulk product exists)

I hope I am clear at this point.

So how would you guys handle this? I have already created them as separate attributes, but that is a no go because you are overcomplete with one attribute in WooCommerce.

1 Answer 1

1

This problem only looks complex, it's not easy either. I'm working on similiar solution now.

WooCommerce doesn't support hierarchical attributes. You can't define quantity attribute as parent of volume (m3) and weight (XX tons) options. I wouldn't separate them - logically this is one attribute (and size is second). Drawback: there will be a lot of variants (5 * 28) - you have to define prices for all of them!

On front we have two select fields in standard theme. Modyfying size parameter is simple - replace select with radio buttons (with jQuery). Quantity parameter select can be replaced with more elements - radio buttons for volume options and select for rest (weights). Choosing any of these options should update form value of original (now hidden) quantity select.

After this we have two attributes (both have to be choosen): size (granularity) and 'kind of quantity'. I wrote 'kind of quantity' because beside attribute selects we have original quantity input. This way we can order f.e. 2 bags (quantity input) x "0,7 m3 minibags, 8-16mm" (variant of 2 attributes).

It can be sufficient (standard) solution for many cases ... but this way we have an option to order only one kind of quantity at one time. This is good for cart, adding the same variants we're getting one line with updated quantity.

Looking at image you need something more usable - 'quantity multiplier' for each 'kind of quantity' (checkboxes for volumes + select for weights). It can be achiewed with more JS on frontend (array of quaintities for choosen quantity kinds) and filters on backend (woocommerce_add_cart_item_data, woocommerce_before_calculate_totals ...). It could have drawbacks, too! - f.e. one cart item of set (1x0,5m3 + 2x0,7m3 + 12ton) - adjusting quantity in cart we're changing amount of sets, not individual quantities.

Using filters we have possibility to almost freely adjust all prices and delivering costs. This way we don't have to define all variant's prices - we can calculate them from needed volume and/or weight! In practice this is only one price (per 1000kg) for each of granularity variants - volume prices can be calculated from weight. Bulk quantities select (25 options) can be replaced with single numerical input (minimum 10[t]) and unit price corelated with ordered quantity (cheaper for greater orders). The same (parametrized) calculations can be done for delivering costs (kind and quantity of trucks, distance).

As optimal (usability, UX) I would create complex frontend (product page) allowing mixed amounts of 'kinds of quantities' but added to cart as separated items (lines) for better manipulations (quantity adjustments) and readability.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.