Skip to content
Snippets Groups Projects
Commit 0d844af0 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

Add support for YITH WooCommerce Multi Vendors

parent 69ecd9d6
No related branches found
No related tags found
No related merge requests found
......@@ -259,6 +259,27 @@ class RulesShippingFrameworkWooCommerce extends RulesShippingFramework {
$data['vendorids'] = array_unique($vendorids);
}
// "YITH WooCommerce Multi Vendor" support (vendors stored in its own taxonomy)
if (function_exists("yith_get_vendor")) {
$vendors = array();
$vendornames = array();
$vendorids = array();
// The plugin provides its own function to retrieve the vendor for a product
foreach ($products as $product) {
$vendor = yith_get_vendor($product['data']->id, 'product');
// $this->printWarning("<pre>vendor: ".print_r($vendor,1)."</pre>");
if ($vendor->is_valid()) {
$vendors[] = $vendor->slug;
$vendornames[] = $vendor->name;
$vendorids[] = $vendor->term_id;
}
}
$data['vendors'] = array_unique($vendors);
$data['vendornames'] = array_unique($vendornames);
$data['vendorids'] = array_unique($vendorids);
}
// END THIRD-PARTY SUPPORT
......@@ -392,6 +413,15 @@ class RulesShippingFrameworkWooCommerce extends RulesShippingFramework {
$vnd_props[] = $vendor->slug;
}
}
// "YITH WooCommerce Multi Vendor" support (vendors stored in its own taxonomy)
if (function_exists("yith_get_vendor")) {
$vendor = yith_get_vendor($p['data']->id, 'product');
if ($vendor->is_valid()) {
$vnd_props[] = $vendor->slug;
}
}
// END THIRD-PARTY SUPPORT
// Check if any of the vendor properties is matched by the conditions; If not => skip product
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment