diff --git a/includes/rules_shipping_framework_woocommerce.php b/includes/rules_shipping_framework_woocommerce.php index f0c75f20e6be7d4305665b2fd00756b329215c74..330746c4e62f6f421702f2746ff2b4ca55792458 100644 --- a/includes/rules_shipping_framework_woocommerce.php +++ b/includes/rules_shipping_framework_woocommerce.php @@ -234,7 +234,14 @@ class RulesShippingFrameworkWooCommerce extends RulesShippingFramework { if (class_exists("WC_Vendors")) { $vendorids = array(); foreach ($products as $product) { - $vendorids[] = $product['data']->post->post_author; + // Variations inherit the vendor from their parent product + if (!isset($product['variation_id'])) { + // "Normal" product, not a variation + $vendorids[] = $product['data']->post->post_author; + } else { + // A variation => load the parent product instead and use its vendor + $vendorids[] = get_post_field('post_author', $product['product_id']); + } } $data['vendorids'] = array_unique($vendorids);