I have a WooCommerce
webshop, where T-Shirts are being sold. When a person looks at the cart, I'd like to give them the option to change sized on a T-Shirt. Currently, the dropdown menu i made looks like this:
<?php
if ( $item->is_type( 'variation' ) ){
?>
<select name="" class="product-size">
<?php
foreach ( $item->get_available_variations() as $variation ):
?>
<option value="">test</option>
<?php
endforeach;
?>
</select>
<?php
}
? >
However, this gives me the following error:
Fatal error: Uncaught Error: Call to undefined method WC_Product_Variation::get_available_variations()
So then it hit me; my $item
variable, is already a variation. Is there a way to get the other variations for the same product?
Thanks