Add Cancellation Policy tick box at checkout

/**
 * @snippet       Add Cancellation Policy tick box at checkout
 * @author        Deepak anand
 * @compatible    WooCommerce 3.6.3
 */
  
add_action( 'woocommerce_review_order_before_submit', 'dcs_add_checkout_privacy_policy', 9 );
function dcs_add_checkout_privacy_policy() {
$Cancellation_pdfPath = get_stylesheet_directory_uri()."/assets/pdf/Cancellation_Return_Policy.pdf";
woocommerce_form_field( 'privacy_policy', array(
'type'          => 'checkbox',
'class'         => array('form-row privacy'),
'label_class'   => array('woocommerce-form__label woocommerce-form__label-for-checkbox checkbox'),
'input_class'   => array('woocommerce-form__input woocommerce-form__input-checkbox input-checkbox'),
'required'      => true,
'label'         => 'I've read and accept the <a target="_blank" href='.$Cancellation_pdfPath.'>Cancellation Policy</a>',
)); 
}
// Show notice if customer does not tick
add_action( 'woocommerce_checkout_process', 'dcs_not_approved_privacy' );
function dcs_not_approved_privacy() {
    if ( ! (int) isset( $_POST['privacy_policy'] ) ) {
        wc_add_notice( __( 'Please acknowledge the  <strong>Cancellation Policy</strong>' ), 'error' );
    }
}