Hello
You would need to render the download cart as PDF button conditionally based on whether the customer has entered their billing and shipping information on checkout. Something like the following:
add_action( 'woocommerce_proceed_to_checkout', function() {
$current_user_id = get_current_user_id();
if ( $current_user_id ) {
$customer = new WC_Customer( $current_user_id );
$billing_address_1 = $customer->get_billing_address_1();
$shipping_address_1 = $customer->get_shipping_address_1();
if ( ! empty( $billing_address_1 ) && ! empty( $shipping_address_1 ) ) {
?>
<a href="<?php echo esc_url( wp_nonce_url( add_query_arg( array( 'cart-pdf' => '1' ), wc_get_cart_url() ), 'cart-pdf' ) ); ?>" class="cart-pdf-button button" target="_blank">
<?php echo esc_html( get_option( 'wc_cart_pdf_button_label', __( 'Download Cart as PDF', 'wc-cart-pdf' ) ) ); ?>
</a>
<?php
} else {
?>
<p><?php esc_html_e( 'Please enter your billing and shipping information on checkout to download cart as PDF.' ); ?></p>
<?php
}
}
} );