Skip to content

Instantly share code, notes, and snippets.

@gorkamu
Created October 9, 2018 17:42
Show Gist options
  • Save gorkamu/c8dd87eddccee2f91b29202525c043a8 to your computer and use it in GitHub Desktop.
Save gorkamu/c8dd87eddccee2f91b29202525c043a8 to your computer and use it in GitHub Desktop.
Extended Woocommerce Variation Class
<?php
class Woo_WC_Product_Variable extends WC_Product_Variable {
public function get_all_variations() {
$available_variations = array();
foreach($this->get_children() as $child_id){
$variation = wc_get_product($child_id);
$available_variations[] = $this->get_available_variation($variation);
}
return array_values(array_filter($available_variations));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment