4 votes
Accepted

Getting started with Order Adjuster plugin

To get an adjuster working, it's really all about consistent naming and making sure PHP can find the class. Here are the main things to address: Your adjuster should be defined in a file that ...
4 votes
Accepted

Can't register custom adjuster with Craft CMS commerce

The error indicates that you're type-hinting the wrong class. Note this line in the error message: Argument 1 passed to amss\amss\AMSS::amss\amss{closure}() must be an instance of amss\amss\...
  • 7,795
3 votes
Accepted

Commerce: Remove tax adjuster from line item in plugin

There is a way to do this, obviously, it is worth noting that the code below is written to be easy to understand and could be improved. Also, it is worth noting that there are plenty of things to ...
2 votes

Commerce: Remove tax adjuster from line item in plugin

@nfourtythree's answer was correct, but just for a 2nd example, here's what I ended up going with: use craft\commerce\Plugin; use craft\commerce\elements\Order; use craft\commerce\models\...
  • 1,932
2 votes

Adjusters: Conditionally include tax in price

Answer is yes, you could use an adjuster to try and make the price "even" while in the cart.
  • 6,712
2 votes
Accepted

How to get all available tax rates in a Commerce site?

Commerce 2 {% set allTaxRates = craft.commerce.taxRates.allTaxRates() %} {% for taxRate in allTaxRates %} {{ taxRate.name }}<br> {% endfor %} taxRate will be an instance of craft\commerce\...
  • 66.8k
2 votes
Accepted

Check for whole cart adjustment and apply line item discount

Success! 1) I have an Event that does a EVENT_BEFORE_SAVE_ELEMENT check. Event::on(Elements::class, Elements::EVENT_BEFORE_SAVE_ELEMENT, function(Event $event){ /** * Runs so an admin ...
2 votes

Module: adding amounts to total item price, based on chosen option (e.g. giftWrapped)

Your instinct to try the Adjuster API is spot-on. However, you've missed one critical aspect of how Adjusters work that may help explain why the changes you're making are unstable or invisible. ...
1 vote

How To Designate Adjuster on Order Only

Can you try this? use craft\commerce\models\OrderAdjustment; $adjustment = new OrderAdjustment(); $adjustment->setOrder($order); // $order - craft\commerce\elements\Order;
  • 496
1 vote

Craft Commerce: Replacing Adjuster causes error "Something changed with the order before payment, please review your order and submit payment again."

having the same issue (also commerce 3.4.15) when the lineItem's tax class gets changed via adjuster (-> no change of totalPrice tho because tax is included in product price) solved -> error in ...
1 vote

Free shipping discount on whole order doesn't appear as adjustment

For anyone else viewing this question - until there is a zero value adjuster as mentioned by Luke, my solution has been to simply do the discount checks in my custom module. A little messy but it'll ...
1 vote

Tax Exempt Adjuster

It seems you're setting the adjuster $taxAdjuster->amount to zero. This should be the correct adjuster code... namespace Commerce\Adjusters; use Craft\Commerce_LineItemModel; use Craft\...
1 vote

Tax Exempt Adjuster

I'm not sure but this jumped out at me $myAdjuster->amount = -$order->totalTax; I don't think you can "negative" a variable in that way. Try $myAdjuster->amount = $order->totalTax * -...
  • 2,009
1 vote

Shipping Adjustment not being added to Total Price

Turns out it was another plugin interfering with the order total.
  • 53
1 vote

Problem with Adjuster plugin Class not found

carbonBalanceAdjuster.php should be CarbonBalanceAdjuster.php since the name of the class is CarbonBalanceAdjuster and you're probably on a case-sensitive file system, which is why auto-loading can't ...
  • 66.8k
1 vote
Accepted

Add Adjuster after Order is completed?

At the moment, both are not possible. The order is locked from recalculation when the order is marked as completed - the final price being locked in. In a future release we will introduce the concept ...
  • 6,712
1 vote
Accepted

Can a plugin manually raise another plugin's Event?

I've built a plugin which uses it's own events before, I guess the way to do it would be the same for separate plugins, however this is untested for your use case. This should go in your plugin ...
  • 4,519
1 vote

Adjusters: Conditionally include tax in price

I put together an example adjuster that checks for a shipping address in Switzerland or the EU, and then applies the 8% or 19% adjustment to the order's item subtotal. It does not include shipping in ...
1 vote

Getting started with Order Adjuster plugin

From your code examples, I believe the issue if you have a file named adjusters/BusinessLogicAdjusters.php, but the class name for that file is BusinessLogic_TaxRemover.
  • 66.8k
1 vote

Commerce: How do I use an adjustor for line items?

I'm finding the question hard to follow, but if I am understanding you, then yes I would do it all in the adjuster - rather than using a discount here... I don't see what using a Commerce discount ...

Only top scored, non community-wiki answers of a minimum length are eligible