Dynamic Product Variation in WooCommerce


I installed WooCommerce and have 3 variable products, however I’d like to add the variation “language”. I don’t want to add as meta information for the products (in the gui), but I would like to use a hook, so I can say that every variable product has a language variation – english and german. I tried using the filter woocommerce_display_product_attributes:

add_filter('woocommerce_display_product_attributes', function($atts, $product) {
  $product_attributes = $product->get_attributes();
  $languages = new WC_Product_Attribute();
  return [
}, 10, 2);

Can someone help me out with this? I would be really grateful!

WPTricks 3 years 2020-03-25T12:50:59-05:00 0 Answers 109 views 0

Leave an answer