Variant next incoming date not working anymore

Variant next incoming date not working anymore

GuillaumeBrs
Shopify Partner
5 0 2

Hi there. 

 

I recently came accross some issues with my `variant.next_incoming_date` returning null, while I have active POs with date on it. It's very random, but it's happening on multiple POs, for different products. But I cannot figure out any logic. We've developped some custom logic for preorder using the `variant.next_incoming_date` attribute, and this is causing issues on our website 😕 Anybody else is experiencing that ?

 

Zight 2024-11-20 at 12.23.04 PM.jpgZight 2024-11-20 at 12.22.34 PM.jpg

 

 

Replies 2 (2)

Ahmad31
Shopify Partner
102 9 8

The issue of variant.next_incoming_date returning null despite having active Purchase Orders (POs) with dates could be caused by several factors. Below are potential reasons and solutions:


1. Potential Issues with Data Sync

Shopify's variant.next_incoming_date relies on data syncing with your inventory system. If the sync between your system and Shopify is delayed or incomplete, the attribute might return null.

Solution:

  • Check the Purchase Orders in Shopify's admin panel to confirm the incoming dates are correctly recorded for the affected variants.
  • Verify the sync process between your inventory management software and Shopify, if applicable.
  • Try re-syncing or manually updating the data to see if the issue resolves.

2. Logic in Custom Code

Your custom code may not account for all scenarios, such as:

  • Variants with no inventory but have incoming stock.
  • Specific states of POs, such as partial fulfillment or drafts, not being captured.

Solution:

  • Add debugging logs to your Liquid code to check what variant.next_incoming_date returns at runtime for different products.
  • Validate that your logic accounts for edge cases, such as:
    • Inactive POs.
    • Partially fulfilled POs.
    • Variants with zero stock but expected incoming stock.

3. Misconfiguration in Preorder Logic

The issue could stem from the way the preorder logic interacts with variant.next_incoming_date. For instance, if your custom logic requires additional PO states or stock conditions, it might not properly retrieve the next_incoming_date.

Solution:

  • Temporarily bypass the preorder logic and directly test variant.next_incoming_date for affected variants to isolate the issue.
  • Ensure your logic handles all null cases and gracefully falls back to a default value if next_incoming_date isn't returned.

4. Cache or CDN Issues

If you're caching the output of variant.next_incoming_date, outdated or stale data may be displayed even if the POs are updated.

Solution:

  • Clear your Shopify theme cache (if any).
  • Disable caching temporarily to test if the issue persists.
  • Ensure your Liquid code dynamically fetches variant.next_incoming_date.

5. API Limitations or Backend Behavior

Shopify's backend might have limitations or delays in updating the variant.next_incoming_date attribute, especially for products with frequent updates.

Solution:

  • Cross-check the incoming stock data through the Shopify API or admin panel.
  • If the issue is consistent across multiple products, consider contacting Shopify Support to verify if there are known issues or limitations with the variant.next_incoming_date attribute.

Temporary Workaround

If the issue is critical and you need a quick fix:

  • Consider using a metafield or custom app to manage and display preorder dates.
  • Populate this metafield manually or through a script that pulls data from your POs.

Next Steps

  1. Debug the variant.next_incoming_date value for problematic products.
  2. Review and refine your custom preorder logic to handle null cases.
  3. Investigate syncing and caching processes.

If you'd like, I can help you adjust your code or suggest a fallback mechanism for this logic. Let me know!

Love my work? Buy me a coffee!
Need a Shopify Developer: Email me Or Chat on Whatsapp
If you found my solution helpful, please like and accept it. Your support is greatly appreciated!
GuillaumeBrs
Shopify Partner
5 0 2

Hi @Ahmad31  and thanks for your replies ! Helas none of these are fixing it. The issue is not at the preorder logic, I don't do any caching, and I'm not using any external inventory system.

 

The issue is really variant.next_incoming_date for all Products on two specifics POs. All other POs are working fine. 

 

In liquid for these products I can see that variant.incoming is returning true, but it's variant.next_incoming_date that is returning null. And only for Products on 2 specifics POs. My assumption is that there was a glitch somehow at PO creation.

 

We are suppose to receive and accept the PO this week, so hopefully this was a one time issue, and it won't happen again 🤞