Christopher,
Looking at that plugin you mentioned, I see it hasn’t received an update in 4 years:
https://d.pr/i/E4XEBU/FtC13PmF2m
… so it’s not surprising that it’s not quite functioning correctly right now. Do you know if the plugin authors are still supporting it or fixing bugs?
I should also say that, while that plugin may be the only one specifically written for the “Pfand”, there are plenty of generic plugins out there that can add fees to products and orders depending on various criteria. Extra Fees for WooCommerce might work for your use case:
https://woocommerce.com/products/extra-fees-for-woocommerce/
There are likely other solutions out there as well, which you can find just by searching.
If you want to add fees manually, that’s also possible with some custom code:
https://docs.woocommerce.com/document/add-a-surcharge-to-cart-and-checkout-uses-fees-api/
Let me know if any of that helps! 🙂
Hi Adam,
Thank you for the detailed and informative reply.
The plugin is not supported or updated by its creators anymore.
Both solutions look very promising and it might especially be an option to use the 2nd link / function to only add these fees to be processed properly with the Amazon Payments gateway.
Before trying this: Can you confirm that this will be working with this plugin?
I found the following code extracts in the Paypal plugin to handle fees:
protected function _get_total_order_fees( $order ) {
$total = 0;
$fees = $order->get_fees();
foreach ( $fees as $fee ) {
$total = $total + $fee->get_amount();
}
return $total;
}
protected function _get_details_from_order( $order_id ) {
$order = wc_get_order( $order_id );
$settings = wc_gateway_ppec()->settings;
$decimals = $settings->is_currency_supports_zero_decimal() ? 0 : 2;
$rounded_total = $this->_get_rounded_total_in_order( $order );
$discounts = $order->get_total_discount();
$fees = round( $this->_get_total_order_fees( $order ), $decimals );
$details = array(
'total_item_amount' => round( $order->get_subtotal() - $discounts + $fees, $decimals ),
But could not find any similar function within yours. It would be great, if you could confirm that the simple fee addition for all Amazon payments would be working. That would save us a lot of trouble 🙂
Thanks again!
Plugin Support
dougaitken
(@dougaitken)
Automattic Happiness Engineer
Hey @ceem123
This is a fairly complex development topic so I’m going to leave it open for a bit longer to see if anyone is able to chime in to help you out.
I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.
You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.
Thanks,
Plugin Support
slash1andy
(@slash1andy)
Automattic Happiness Engineer
We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.