The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Custom Shipping Endpoint - Custom Message

SimonSimon Member
in Help edited November 2016

We are using the custom shipping endpoint with the weights of our orders and it is working really well domestically,

Our issue is that when an international customer has an order that is over 2kg we cannot provide a quote automatically as it depends on the dimensions of the package as well as the weight.

We had the endpoint set up to use the error() function to display a message to the customer informing them that we need to contact them. Unfortunately if we throw an error the customer cannot complete the purchase as there is a "missing" piece of information (the shipping).

I was planning on using the shipping methodand service in combination with free shipping to inform the customer to continue with their purchase and we would then contact them to pay for shipping before dispatch.

$rates->add(20050, 0.00, 'International Delivery Quote', ' - Please proceed with your order and we will contact you with a choice of delivery options.');

The issue with this method is that the order will then appear in Orderdesk with the method and service as the shipping method:-

International Delivery Quote - Please proceed with your order and we will contact you with a choice of delivery options.

This is not really workable. So, is there another way I can convey a message to the customer in the cart & checkout that we will contact them to provide shipping quotes after they have submitted their order and allow them to order with no/free shipping?

  • fc_romanfc_roman Member, FoxyCart Team

    Let us look for viable alternatives and we'll be back. Thank you.
  • fc_adamfc_adam FoxyCart Team

    Would there be an acceptable shipping label that you could set for this type of order? With what you're describing - for the customer to be able to complete their checkout, they will need some form of shipping rate that can be selected on the cart. If you can generate a rate label that you're happy with from your endpoint, you can then set up some logic on your checkout to display a custom message to the customer if it's an international order and the weight is greater than 2kg. If that could work - we can get you some code for showing that custom message.
  • Hi @fc_adam

    That sounds workable. For the time being I have just set up a "free" shipping rate and called it "International Delivery Quote".

    That works in as much as they can complete checkout, but it doesn't provide a clear enough message about what will happen once they have paid and will likely put some people off continuing.

    So yes, if you can provide some code that will allow us to display a message for certain countries and weights that would be great.


  • fc_adamfc_adam FoxyCart Team

    Cool. For the message, you could approach it like this: On your checkout template in the FoxyCart administration, set it to a "Custom Template" and look for the {% embed '' %} and {% endembed %} lines. In between the two of them, paste this:
    {% block payment_method %}
    {% if != "US" and total_weight_shippable >= 2 %}
    <p>Custom message because this is too heavy and international</p>
    {% endif %}
    {{ parent() }}
    {% endblock %}
    You just need to customise that markup to be whatever you need it to be - you can add whatever you want there, and then style it with CSS as required.

    One piece of CSS you'll want to add as well is this:
    <style type="text/css">#fc-payment { position:relative; }</style>
    This will fix a small style issue with the padlock that the above Twig code causes when applied. You can add that CSS to the custom "header" textarea of the config option for "Add custom header and footer code to your templates", as found on the configuration page of your store's FoxyCart administration.
  • Thanks @fc_adam

    I'll have a look at implementing this on the checkout.

    We will also need a solution for the sidecart. How can we accomplish that?

  • fc_romanfc_roman Member, FoxyCart Team

    You could try placing the key part of the same code in your cart include template, — for example, above the line <div data-fc-id="block-order-totals">:
    {% if context != "checkout" %}
    {% if != "US" and total_weight_shippable >= 2 %}
    Custom cart message because this is too heavy and international
    {% endif %}
    {% endif %}
    Will this work?
Sign In or Register to comment.