How to delete attachments associated with custom field type when post property changes? [closed]

You can use the save_post hook.

add_action( 'save_post', 'mytheme_my_post_just_updated' );

function mytheme_my_post_just_updated($post_id){

    $deal_type = get_field($post_id, 'deal_type');

    if($deal_type == 'sold'){

       $gallery = get_field($post_id, 'gallery');// This bit and the next few lines will depend on how you've set up the custom field. 

        // Fast forward a few lines...
        foreach($images as $image){ // I'm assuming that $images is an array of attachment_ids, but will depend on how you've used ACF to create the custom field
            wp_delete_attachment($image, true); // args are attachment_id and whether or not to bypass trash.
        }

    }

}

Put the above code into your theme’s functions.php.

More on wp_delete_attachment()https://codex.wordpress.org/Function_Reference/wp_delete_attachment