Hello
Do you have the WC Cart PDF option Capture customer information on checkout enabled within the settings under WooCommerce > Settings > Integration > Cart PDF?
This would save the fields the user types into on the checkout, even if they are a guest. For your use case, you may want to hide the cart pdf button from the customer until they populate the billing and/or shipping fields.
Alternatively, you could modify the modal popup on the cart page to include additional fields besides just email.
Hi David,
Thank you for the reply. We do have the option to Capture customer information on checkout enabled. We do want to allow customers to have the option get a quote with and without shipping being populated, so hiding the cart pdf button is not an option at the moment.
Would I modify the popup by adding code to the modal-capture.php file, or is there a different way to go about that?
You would copy the modal-capture.php file into your child-theme/woocommerce/wc-cart-pdf/modal-capture.php file.
For the additional field names you add to the modal, if you stick with the default naming conventions it will work with the capture customer info on checkout, e.g.:
'email',
'first_name',
'last_name',
'display_name',
'username',
'billing_first_name',
'billing_last_name',
'billing_company',
'billing_address_1',
'billing_address_2',
'billing_city',
'billing_postcode',
'billing_country',
'billing_state',
'billing_email',
'billing_phone',
'shipping_first_name',
'shipping_last_name',
'shipping_company',
'shipping_address_1',
'shipping_address_2',
'shipping_city',
'shipping_postcode',
'shipping_country',
'shipping_state'
-
This reply was modified 5 months, 1 week ago by David Jensen.
Okay sounds good, we are using the default conventions so that should be easy enough. I will give this a try, thank you!
No problem. Feel free to reply here if you need further assistance
I might be doing something wrong, I’ve added those sections to the modal pop-up, and that part works. However, that information does not look to be populating in the actual pdf. Or is that something which is outside of the functionality of the plug-in?
Well by default the addresses do not display on the PDF. The plugin is based around just showing what is displayed in the native WooCommerce cart, though it is flexible enough with some coding to accomodate your needs.
You can modify the PDF, by copying the cart-table.php file to your child theme, same place as the modal-capture.php file you copied, and then adding the addresses to the cart-table.php file using WC_Customer()
methods such as: $customer->get_billing_address()
or $customer->get_shipping_address()
.
-
This reply was modified 5 months, 1 week ago by David Jensen.
Ah of course, we actually did that for logged in users already, just not for non-logged in users. I can give that a try.