Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Stewart Toye 9 posts 108 karma points
    Oct 04, 2022 @ 16:17
    Stewart Toye
    0

    Vendr GetProductStock method

    Hi,

    I'm using the below Vendr (3.0.0-rc0050) method to find out if a product has any stock.

    var currentStock = _vendrApi.GetProductStock(storeId, productReference);
    

    The issue I'm experiencing is that stock is being returned from products that have been unpublished or deleted. Note the only way to get 0 back is to delete the product from recycle bin.

    Are there any Vendr methods that caters for unpublished or deleted products? I.e if a product page is unpublished or deleted I would expect the stock level returned to be 0.

    Thanks Stewart

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Oct 05, 2022 @ 07:55
    Matt Brailsford
    0

    Hi Stewart,

    The GetProductStock method will return a stock level for a given product reference regardless of the products state.

    What is the surrounding code to this? Could you pre filter before this code to exclude product nodes that are unpublished / trashed?

Please Sign in or register to post replies

Write your reply to:

Draft