1

What is the best way to implement advanced shipping cost calculations? Custom adjusters were deprecated right? I need to add shipping costs based on the total price of all products from a specific type.

My client sells products that don't require shipping costs and products that do. The shipping costs are based on the total price of the order. However, products that don't require shipping costs are (obviously) included in the order total which means the shipping costs are higher than they should be.

Is there any way to make this work? Thanks in advance!

1

products that don't require shipping costs are (obviously) included in the order total which means the shipping costs are higher than they should be.

It sounds like you're only using one shipping class? Commerce can provide multiple ways to ship (methods) but also how to handle different categories of products (shipping categories).

What I'd do is create 2 shipping classes: one that includes shipping, another without.

Then set the products that have the shipping costs built-in to only use the Shipping Included in Price category (whatever you've named it). That takes care of excluding costs for the products that already include shipping.

enter image description here

You mention the cost for the other products is based on the total of the order. One way to handle this would be to set a percentage per item since those items will end app as the total (ignoring the other products that already have shipping cots.)

You can set this up in the shipping Costs panel. So in the General category in the example below, I set the shipping cost to be 10% of the item (0.1) but you could also do weight or a flat per item. You can also set a minimum or max shipping costs depending on what you're trying to do.

enter image description here

Custom adjustment types are deprecated but the doesn't affect shipping, discount, and tax adjusters—basically items that Commerce knows about.

1

I ended up using a custom adjuster anyways. I found out that registering custom adjusters hasn't been deprecated, but using custom types has.

https://craftcms.com/docs/commerce/3.x/adjusters.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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