I need to return the post or product id when the custom field is set to true on any specific Edit Product screen.
foreach ( $cart->get_cart() as $key => $cart_item ) {
$field = get_post_meta( $cart_item['product_id'],'_free', true );
}
var_dump( $field ) returns 1 as the switch is set to true, great, but i need the I.D as well as i need to use it in the code.
You are using the product ID in the code to get the field value, you already have it in $cart_item['product_id']