ESHOPMAN Draft Order Shipping: Ensuring Your Custom Prices Stick

At Move My Store, we're always diving deep into the nuances of the ESHOPMAN platform to bring you actionable insights. Today, we're shedding light on a critical aspect of managing draft orders within ESHOPMAN: how custom shipping method prices are handled, particularly when updated via the HubSpot Admin dashboard.

Many ESHOPMAN merchants and developers rely on the flexibility of setting custom shipping amounts for draft orders. Whether it's to offer a special rate or correct a pricing error, the ability to manually adjust shipping costs is vital for storefront management. However, a recent community insight has highlighted a specific scenario where these custom prices might not persist as expected, leading to potential discrepancies in your ESHOPMAN storefront's pricing.

The ESHOPMAN Draft Order Pricing Conundrum

The core issue arises when an ESHOPMAN administrator updates an existing shipping method's price on a draft order through the HubSpot Admin dashboard. This action typically triggers the ESHOPMAN Admin API, specifically involving a workflow that passes a custom_amount for the shipping method. While the new amount is successfully recorded, a crucial flag, is_custom_amount, remains set to false.

Why is this significant? In ESHOPMAN's headless commerce architecture, the is_custom_amount flag serves as a clear indicator that a shipping method's price has been manually overridden. When this flag is not correctly set to true, the system treats the manually entered price as if it were a standard, computed cost. This can have unintended consequences, especially when other ESHOPMAN workflows are executed.

For instance, ESHOPMAN includes processes designed to refresh or re-price non-custom shipping methods. If your custom-set shipping method lacks the is_custom_amount: true flag, these re-pricing workflows might inadvertently overwrite your carefully applied custom price, reverting it to a system-calculated value. This behavior can lead to confusion for both administrators and customers, impacting the accuracy of your ESHOPMAN storefront's order totals.

A Look Under the Hood: ESHOPMAN Workflows

The technical discussion points to the updateDraftOrderShippingMethodWorkflow and its underlying step, updateDraftOrderShippingMethodStep, as the source of this behavior. When this step is invoked, it primarily focuses on updating the amount of the shipping method. The current implementation, as observed by the community, does not account for setting the is_custom_amount flag, even when a custom_amount is provided in the input.

const [updatedMethod] = await service.updateOrderShippingMethods([
  {
    id: input.shipping_method_id,
    shipping_option_id: input.shipping_option_id,
    amount: input.amount,
  },
])

As you can see in the snippet above, the object passed to service.updateOrderShippingMethods only includes id, shipping_option_id, and amount. The is_custom_amount property is conspicuously absent from this update payload.

Expected vs. Actual Behavior in ESHOPMAN

The expected behavior for ESHOPMAN developers and merchants is clear: when a custom_amount is provided during a shipping method update, the system should store this method with is_custom_amount: true. This mirrors the behavior seen when initially adding a shipping method with a custom price using the addDraftOrderShippingMethodsWorkflow, ensuring consistency across the platform.

However, the actual behavior is that while the amount is updated to the custom value, the is_custom_amount flag remains false.

Reproducing the Issue for ESHOPMAN Developers

To verify this behavior within your ESHOPMAN setup, follow these steps:

  1. Create a draft order in ESHOPMAN through your HubSpot Admin dashboard, ensuring it has at least one item and a standard shipping method (without a custom amount initially).
  2. Using the ESHOPMAN Admin API, make a POST request to the endpoint for updating a shipping method on your draft order: /admin/draft-orders/:id/edit/shipping-methods/method/:method_id. In the request body, include { "custom_amount": 15 } (or any desired custom value).
  3. After confirming the edit, retrieve the details of the draft order's shipping method via the ESHOPMAN Admin API. You will observe that the amount field reflects your custom value (e.g., 15), but the is_custom_amount field remains false.

Conclusion for the ESHOPMAN Community

This insight is crucial for anyone managing ESHOPMAN draft orders, especially those leveraging custom shipping prices. Understanding this behavior allows developers to anticipate potential pricing inconsistencies and implement workarounds if necessary, ensuring that your ESHOPMAN storefront's pricing remains accurate and reliable. As the ESHOPMAN platform continues to evolve, community insights like these are invaluable for refining its capabilities and ensuring a robust headless commerce experience integrated with HubSpot.

Start with the tools

Explore migration tools

See options, compare methods, and pick the path that fits your store.

Explore migration tools