Thanks again for your quick response.
I have now found out that the problem has something to do with the shipping packages.
I came across a snippet that is splitting Shipping Packages by shipping class:
<?php
/**
* Split all shipping class 'A' products in a separate package
*/
function custom_split_shipping_packages_shipping_class( $packages ) {
// Reset all packages
$packages = array();
$regular_package_items = array();
$split_package_items = array();
$split_shipping_class = 'a'; // Shipping class slug
foreach ( WC()->cart->get_cart() as $item_key => $item ) {
if ( $item['data']->needs_shipping() ) {
if ( $split_shipping_class == $item['data']->get_shipping_class() ) {
$split_package_items[ $item_key ] = $item;
} else {
$regular_package_items[ $item_key ] = $item;
}
}
}
// Create shipping packages
if ( $regular_package_items ) {
$packages[] = array(
'contents' => $regular_package_items,
'contents_cost' => array_sum( wp_list_pluck( $regular_package_items, 'line_total' ) ),
'applied_coupons' => WC()->cart->get_applied_coupons(),
'user' => array(
'ID' => get_current_user_id(),
),
'destination' => array(
'country' => WC()->customer->get_shipping_country(),
'state' => WC()->customer->get_shipping_state(),
'postcode' => WC()->customer->get_shipping_postcode(),
'city' => WC()->customer->get_shipping_city(),
'address' => WC()->customer->get_shipping_address(),
'address_2' => WC()->customer->get_shipping_address_2()
)
);
}
if ( $split_package_items ) {
$packages[] = array(
'contents' => $split_package_items,
'contents_cost' => array_sum( wp_list_pluck( $split_package_items, 'line_total' ) ),
'applied_coupons' => WC()->cart->get_applied_coupons(),
'user' => array(
'ID' => get_current_user_id(),
),
'destination' => array(
'country' => WC()->customer->get_shipping_country(),
'state' => WC()->customer->get_shipping_state(),
'postcode' => WC()->customer->get_shipping_postcode(),
'city' => WC()->customer->get_shipping_city(),
'address' => WC()->customer->get_shipping_address(),
'address_2' => WC()->customer->get_shipping_address_2()
)
);
}
return $packages;
}
add_filter( 'woocommerce_cart_shipping_packages', 'custom_split_shipping_packages_shipping_class' );
Link to the Author/ Blog: https://jeroensormani.com/splitting-shipping-packages-in-woocommerce/ (There are also options to make packages by Product-ID or Category.)
With this snippet, the distribution of the shipping costs in PayPal works perfectly.
BUT:
The snippet creates packages attached to the classes. Can you help me to create the snippet packages based on the vendors? For example with the Vendor Slug or Vendor-ID?
I would be very happy if you could help me further – I would even make a small donation for it!
Thanks