This is an old revision of the document!
Table of Contents
Auto-Fill and Hide Purchase Order Field
If your site is made for creating quotes, or similar functionality, where you don't want to require payment from your customers, you can pre-fill the Purchase Order field and hide it so your customers can check out without providing payment or a Purchase Order.
Step 1: Turn on purchase orders
Note: An active FoxyCart subscription is required in order to access and use the Purchase Order option.
Go to your Payment Gateway Settings and turn on the option for Let customers pay with a Purchase Order:
Step 2: Add snippet to your Checkout template to populate the P.O. field
- In your Foxy administration, head to the checkout template page
- In the template, after the line
{% embed 'checkout.inc.twig' %}paste the following snippet:
{% block payment_method %} {% set purchase_order = "Quote" %} {{ parent() }} {% endblock %} - Save the template
Step 3: Add snippet to custom header to hide the P.O.
- Go to the “Configuration” page in the administration and look for the option labelled
Add custom header and footer code to your templates. You may need to check the box to see the followingcustom header:textarea. - In the
custom headertextarea, paste the following snippet. If there's already code in the box, paste at the bottom of the code already present there:<style type="text/css"> #fc #fc-payment-method-purchase-order .fc-form-group { display: none; } #fc #fc-payment-method-purchase-order .fc-input-group-container--active { padding-bottom: 0px; } #fc #fc-payment-method-purchase-order .fc-input-group-container__title { border-radius: 5px; } </style> - Save the configuration.
If you then load up your checkout - you should see the purchase order method still displayed - but without the text input section below it when selected.
===== Optional Step: Customize language on the Checkout ===== You can change/remove the image and text for Purchase Order on the checkout by customizing the language strings.
- Go to the language templates customization in your FoxyCart admin.
- Click the
show all detailsbutton. You'll see custom language fields. - You can scroll until you see
pay with purchase order:or use your browser's find feature to locate it. Just change the text to what you desire. If you want to format it, you can use html formatting. - Scroll to the bottom of the page and click
Update Language Customizationsto save.