- Status
- Gelöst
- Gelöst in
- 4.12.0
- Zugehöriges Plugin/Theme
- WooCommerce Dynamic Pricing
Übersicht über das Problem
Wenn Sie die Funktion Advanced Category Pricing des Plugins WooCommerce Dynamic Pricing verwenden, werden die Rabatte nicht auf variable Produkte angewendet (nur auf einfache Produkte).
Problemumgehung
Wir haben bereits eine dauerhafte Lösung für das Problem, die auf vollständige Tests und die nächste Version wartet. In der Zwischenzeit können Sie die folgende Problemumgehung verwenden, um das Problem auf Ihrer Website zu beheben:
- Erstellen Sie ein vollständiges Backup Ihrer Website, bevor Sie fortfahren.
- Öffnen Sie wp-content/plugins/woocommerce-multilingual/compatibility/class-wcml-dynamic-pricing.php und suchen Sie Zeile 118.
- Ersetzen Sie dies:
public function woocommerce_dynamic_pricing_is_applied_to( $process_discounts, WC_Product $_product, $module_id, $dynamic_pricing, $cat_ids ) { if ( ! $_product || ! $cat_ids || ! $this->has_requirements( $dynamic_pricing ) ) { return $process_discounts; } $taxonomy = $this->get_taxonomy( $dynamic_pricing ); $product_id = apply_filters( 'wpml_object_id', $_product->get_id(), 'product', true ); return is_object_in_term( $product_id, $taxonomy, $this->adjust_cat_ids( $cat_ids, $taxonomy ) ); }durch
public function woocommerce_dynamic_pricing_is_applied_to( $process_discounts, WC_Product $_product, $module_id, $dynamic_pricing, $cat_ids ) { if ( ! $_product || ! $cat_ids || ! $this->has_requirements( $dynamic_pricing ) ) { return $process_discounts; } $taxonomy = $this->get_taxonomy( $dynamic_pricing ); $product_id = apply_filters( 'wpml_object_id', $_product->get_id(), 'product', true ); //fix for variable products if ($_product->post_type === "product_variation") { $product_id = wc_get_product( $_product->get_parent_id() )->get_id(); $product_id = apply_filters( 'wpml_object_id', $product_id, 'product', true ); return is_object_in_term( $product_id, $taxonomy, $this->adjust_cat_ids( $cat_ids, $taxonomy ) ); } return is_object_in_term( $product_id, $taxonomy, $this->adjust_cat_ids( $cat_ids, $taxonomy ) ); }