skip to Main Content

I have almost 2000 products on my Shopify store but the price for each of these products (available on other website) vary for few moments a day. Specifically, some products prices vary 2-3 times a day.
Luckily, I am a developer and I have developed a selenium bot to update these prices; however, the bot takes up to 8 hours to finish updating per day (Internet issues and other stuffs) which limits my chance of being able to update it more than once a day; so, I lose money on a product if the price changes after I made update.
My question is that: is it advisable to use webhook to monitor over 2000 products from other website and update mine or is there an economical solution compared to my method and the webhooks?

2

Answers


  1. I would do the following. Setup a scheduled job to run 2x or 3x per day. Using a single API call you can download your entire Shopify inventory pricing in a JSON file. So you download that file. You have access to correct prices from these "other" sources. So all you need to do is update the JSON of your Shopify store inventory. Now, with one API call, you can provide that inventory back to Shopify, and Shopify will update your pricing. So, another API call. That is not an 8 hour job, nor does it require a bot. It is really a simple pattern. Let Shopify do all the work. So for you, ensuring correct pricing is your challenge. Nothing to do with Shopify, but instead, probably, by the sounds of it, a web scraping activity you do.

    Login or Signup to reply.
  2. Webhooks (API calls) are always going to be faster than Selenium. Always.

    It seems to me the most efficient route to update pricing would be to follow the steps below.

    Overview

    The basic concept is that each time the script is run, we download the other site’s pricing file and compare it to the last one we downloaded. If there are pricing changes, update the prices on your storefront.

    One time setup

    Download the pricing from the other site and store on disk for access from the script.

    Script

    1. Load from disk the last pricing you downloaded from the other site and convert to dataframe (df_current).
    2. Download the new pricing from the other site and convert to dataframe (df_new).
    3. Compare dataframes looking for price differences.
    4. If a product price changed, update the pricing for that product using an API call.
      1. Repeat until all prices are updated.
    5. Replace the existing pricing download from the other site for the next run.

    This whole cycle shouldn’t take more than maybe a minute? It should be very, very fast.

    You’ll have to potentially tweak that design depending on how many of the 2000 prices are likely to change at any given time. If it’s a small number, the above is probably fine. If it’s most of the products each time, then you may want to bulk edit the JSON and update all prices with a single call. That’s just going to require more code… either way, it’s up to you.

    Scheduling

    Once you get the above script written, you can set it on a schedule to run every hour or whatever your needs are.

    Reference

    I found this page with what looks like a very good intro to retreiving and updating pricing on Shopify using the API.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search