My goal at the end is adding all my variations to the cart fast using only the ID list of the variations, but whatever I try I can't get to display a list of this variations on the cart page...
add_action( 'woocommerce_before_cart', 'custom_echo_product_ids' );
function custom_echo_product_ids() {
$all_ids = get_posts( array(
'post_type' => 'product',
'numberposts' => -1,
'post_status' => 'publish',
'fields' => 'ids',
) );
foreach ( $all_ids as $id ) {
echo $id->get_children() . , . ;
}
}