This topic contains 2 replies, has 0 voices, and was last updated by Aaron@MIT 8 years, 2 months ago.

  • Author
    Posts
  • #6187

    Aaron@MIT

    I am losing my mind trying to get the right shipping costs out of a sales order.

    Scenario

    When a customer places an order on our webstore, they are charged a flat $5.00 for shipping, as is set up by our Shipping Items.

    The customer can also enter a promo code which grants them free shipping.

    When the order is placed, the shiping cost is taken from the SO and displayed in an order confirmation email that is sent to the customer via Suitescript.

    Problem

    The Suitescript API consistently returns the wrong value when the above scenario happens.

    There are two fields from which we can potentially get the shipping cost on an order: shippingcost and altshippingcost. I’ll focus on shippingcost because altshipping cost also returns the wrong values. It is almost like these fields don’t get updated by promo codes until a few seconds after the order is placed. Until that time, these fields can return incorrect information.

    In order to have a reliable way of getting the shipping cost, I need something that gets me the correct cost if the customer DOES enter a promo code or if they do NOT enter one. In the following examples, you can see that for every way that I’ve tried to get this information, the incorrect value is returned in at least one of those two situations

    I have tried getting the shippingcost value via the following methods:nlapiGetFieldValue (within afterSubmit)
    nlapiLookupField (within afterSubmit, looking up the value of the very Sales Order that was submitted)
    nlapiLoadRecord.getFieldValue (within afterSubmit. Loading the very SO that was submitted)
    nlapiGetNewRecord.getFieldValue (within afterSubmit)
    nlapiLoadRecord (called within a Scheduled Script that was scheduled within afterSubmit of this SO)

    Every single one of these returns $5.00 shipping cost even if a promo code is applied. Orders with promo codes should have a shipping cost of $0.00.

    The only time that I’ve gotten the correct values is if I save the order, then wait a few seconds, then trigger a separate script altogether to get the value. Then all of them return the correct $0.00. What am I doing wrong? Is this a problem in Netsuite. I’m at a loss for what I can do to get it to work. An absolute loss. Can anyone help with this?
    This is a cached copy. Click here to see the original post.

  • #6188

    david.smith

    Wouldn’t you want your customer that is ordering from your website to know the shipping cost before they commit the order? This should be done at the time the order is created, not after. That said, I’m not sure what the issue is with the promo unless it has something to do with other scripts running and some order of operation.

  • #6189

    Aaron@MIT

    The customer does know their shipping cost because our webstore is designed to display the effects of the promo before the order is placed. What I’m working on is simply the confirmation email that the user gets after they place the order. It is thus very important that my email be able to access the correct value because the user will have seen their free shipping just moments prior. If my email then says that they were charged shipping (even though Netsuite correctly shows free shipping in the UI), it will be confusing and reflect poorly on our company.

You must be logged in to reply to this topic.