Ensuring Seamless Pickup for Backordered Items in ESHOPMAN
Addressing Backorder Inventory Flags for ESHOPMAN Pickup Options
At Move My Store, we understand the critical importance of a seamless checkout experience for your ESHOPMAN storefront. ESHOPMAN, built on Node.js/TypeScript and seamlessly integrated with HubSpot for storefront management and CMS deployment, offers robust features for headless commerce. However, a recent community discussion highlighted a specific challenge concerning backordered products and pickup shipping options.
The issue arises when ESHOPMAN products configured with allow_backorder=true and an inventory_quantity=0 are incorrectly flagged as having insufficient_inventory=true. This misidentification, particularly within the context of 'Pickup at Storage Location' or similar custom shipping methods, prevents customers from selecting the pickup option at checkout, even when backordering is a valid fulfillment strategy.
The Use Case: Pickup for Backordered Items
Many ESHOPMAN merchants offer flexible fulfillment methods, such as direct customer pickup at a physical warehouse or storage location. For businesses dealing with custom parts or made-to-order items, allowing customers to place orders for backordered products and then pick them up once ready is a common and valuable service. Payment might even be handled upon pickup, reinforcing the need for this option to remain available regardless of immediate stock levels.
Understanding the Root Cause
The core of the problem lies within ESHOPMAN's internal shipping option calculation logic, specifically in a core workflow file responsible for listing shipping options for a cart. During the inventory check for pickup locations, the system currently filters items that lack available quantity without adequately considering the allow_backorder flag. This means if an item's inventory_quantity is zero, it's immediately marked as unavailable for pickup, even if the product is explicitly set to allow backorders.
Proposed Solution for ESHOPMAN Developers
To resolve this, the ESHOPMAN community has identified a two-step fix that involves modifying the core workflow responsible for shipping option calculations. This fix ensures that products allowing backorders bypass the immediate inventory quantity check for pickup options.
1. Enhance Cart Query Fields
The first step is to ensure that the allow_backorder property of a variant is included when querying cart items. This makes the information available for subsequent checks.
fields: [
...cartFieldsForPricingContext,
"items.*",
"items.variant.manage_inventory",
"items.variant.allow_backorder", // Add this line
"items.variant.inventory_items.inventory_item_id",
// ...
]2. Modify Inventory Check Logic
Next, the logic that determines itemsAtLocationWithoutAvailableQuantity needs to be updated. Before flagging an item as having insufficient inventory, an additional check for item.variant?.allow_backorder should be performed. If backorder is allowed, the item should be considered 'available' for pickup.
const itemsAtLocati => {
if (!item.variant?.manage_inventory) {
return false
}
// If backorder is allowed, item is always "available" for pickup
if (item.variant?.allow_backorder) {
return false
}
return item.variant.inventory_items.some((inventoryItem) => {
// ... existing logic for checking location levels
})
})Current Workaround
While an official update is pending for ESHOPMAN installations running version 2.0 or higher, developers can implement this fix locally using tools like patch-package. This allows immediate resolution of the issue and ensures that your ESHOPMAN storefront, managed via HubSpot, provides the intended flexibility for pickup options with backordered items.
This community insight empowers ESHOPMAN developers to maintain an optimal checkout flow, enhancing customer satisfaction and leveraging the full power of ESHOPMAN's headless capabilities.