Support » Plugin: WooCommerce Amazon Pay » Fee not transferred and processed

  • Resolved Christopher Mailänder

    (@ceem123)


    Hi there,

    Thank you very much for this plugin and the support you are offering in this forum.

    We are a retailer whose product assortment includes beverages. In Germany you have to pay a deposit (“Pfand”) on most of the bottles for beverages. This deposit must not be included in the price of the product itself, but has to be listed separately.

    The deposit handling can be done with this plugin and as far as I know this is the only one that’s available for this task:
    https://wordpress.org/plugins/pfand-deposit-for-woocommerce-products/

    The deposits for all articles in the cart are summed up and added to the order as a fee. We do not have any issues with this fee with any other payment plugin and yours is also showing it correctly after logging in (on the checkout page). However, when confirming the order value, a lower value (without the fee) is being processed.

    An example product would be: https://bioaufvorrat.de/bio-produkt/neumarkter-lammsbraeu-lammsbraeu-dinkel-bio-10-x-033l/

    Is there perhaps a hook or filter available, where we could alter the amount being processed and add the fee?

    If I need to provide further information, please do not hesitate to let me know.

    Thank you!

    Best regards,
    Christopher

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Adam

    (@adamkheckler)

    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 AW

    (@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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.