WP Offload SES

Stripe Connect shipping fee forwarding to Stripe
I found a bug in the WP Engine Stripe Checkout integration related to WooCommerce shipping costs. I am using WooCommerce with the WP Engine Stripe Checkout feature enabled. In my WooCommerce cart, the shipping cost is calculated correctly as €6.90 gross. The selected shipping method is flat_rate:1, and my debug log directly before the checkout button confirms the correct WooCommerce shipping rate: Chosen shipping methods: [0] => flat_rate:1 Rate ID: flat_rate:1 label=Versandkostenpauschale method_id=flat_rate instance_id=1 cost=5.75 taxes: [167] => 1.15 Cart shipping tax: 1.15 So WooCommerce has the correct calculated shipping rate: €5.75 net + €1.15 tax = €6.90 gross. However, the Stripe Checkout Session created by WP Engine sends only €1.15 as the shipping amount. In the Stripe Dashboard request body I see: "shipping_options": { "0": { "shipping_rate_data": { "display_name": "Versandkostenpauschale", "fixed_amount": { "amount": "115", "currency": "EUR" }, "metadata": { "id": "flat_rate", "cost": "0", "instance_id": "1", "method_title": "Versandkostenpauschale", "plugin_id": "woocommerce_", "tax_status": "taxable", "taxes_amount": "115", "taxes_currency": "EUR" }, "tax_behavior": "unspecified", "type": "fixed_amount" } } } This causes Stripe Checkout to charge only €1.15 shipping instead of €6.90. As a result, customers underpay shipping by €5.75. I traced the issue to this WP Engine file: /wpe-configuration/includes/woo/features/shipping.php In WpeShipping::wooCommerceHasShippingRates(), the code appears to build the Stripe shipping amount from the static shipping method setting: $cost = (empty($shipping_method->instance_settings['cost']) ? 0 : $shipping_method->instance_settings['cost']); $cost = (float) $cost * 100; In my case, $shipping_method->instance_settings['cost'] is empty or 0, even though the actual selected WooCommerce shipping rate is correctly calculated in the cart as €5.75 net + €1.15 tax. Then the code adds the shipping tax from the cart: $shipping_taxes = WC()->cart->get_shipping_taxes(); foreach ($shipping_taxes as $tax) { $amount = (float) $tax * 100; $shipping_rate_data['metadata']['taxes_amount'] = $amount; $shipping_rate_data['metadata']['taxes_currency'] = get_woocommerce_currency(); // Add the extra tax cost to the shipping rate $shipping_rate_data['fixed_amount']['amount'] += $amount; } Because the base cost is 0 and only the tax amount is added, Stripe receives fixed_amount.amount = 115. I believe the integration should not use $shipping_method->instance_settings['cost'] to determine the Stripe shipping amount. It should use the actual selected WC_Shipping_Rate from WC()->shipping()->get_packages(), because that contains the real calculated shipping cost and taxes after WooCommerce has applied zones, tax settings, filters, free shipping logic, and other dynamic shipping calculations. In my case, the correct selected rate is available in WooCommerce as: rate_id = flat_rate:1 cost = 5.75 taxes = 1.15 gross = 6.90 So the Stripe Checkout Session should receive: "fixed_amount": { "amount": "690", "currency": "EUR" } instead of: "fixed_amount": { "amount": "115", "currency": "EUR" } Could you please check whether this is a bug in the WP Engine Stripe Checkout implementation and provide a fix?
0