This is an old revision of the document!


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

  • 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

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 following “custom header:” textarea. In the “custom header” textarea, 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. ​ ​You can change/remove the image and text for purchase order by customizing the language strings.

To change: Go to the language templates customization in your FoxyCart admin. Here's a link to that: https://admin.foxycart.com/admin.php?ThisAction=Internationalization Click the “show all details” button. 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. The text here should look familiar – you'll just change it 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 Customizations” to save.

Site Tools