Woocommerce - Sort products in cart by Author/User in Multi-vendor setup
问题 I have a multivendor Woocommerce shop using Dokan plugin and I'm trying to split out the shopping cart into sections based on who the vendor is. For example: Vendor 1 Product C Product B Vendor 2 Product A Dokan uses a custom role 'vendor' to extend the user class, so to get the ID of the vendors, I should be able to use something like: $post_data = get_post( $cart_item['product_id'] ); $vendor_id = $post_data->post_author; This does work, but it will only get the first vendor ID and simply