Custom Shipping Endpoint - Custom Message

SimonSimon Member
in Help edited November 2016
Hi,

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?


Thanks,
Simon
Comments
  • fc_romanfc_roman Member, FoxyCart Team
    @Simon,

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

    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.

    Thanks,
    Simon


  • fc_adamfc_adam FoxyCart Team
    @Simon,

    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 'checkout.inc.twig' %} and {% endembed %} lines. In between the two of them, paste this:
    {% block payment_method %}
    {% if shipping_address.country != "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?

    Thanks
  • fc_romanfc_roman Member, FoxyCart Team
    @Simon,

    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 shipping_address.country != "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.