Submit a request

Add sale_price to Google Shopping auto feed

Completed

Comments

19 comments

  • Official comment
    Avatar
    Jack Cravy

    I realize this conversation has evolved past just the sale_price. But.. it's in 2021.4!

    https://support.americommerce.com/hc/en-us/community/posts/4405925474075-2021-4-Release-1-4

    Kathy, we are working on a new feature request portal that will be released soon. 

    Comment actions Permalink
  • Avatar
    Brian Gluck

    great request. we had to build custom middleware  to process our feeds to ensure our sale prices are passed to Google for this same purpose.

    1
    Comment actions Permalink
  • Avatar
    Kathy Sechrist

    I sure miss the old forums website where we could easily have conversations about a specific topic, and it was a lot easier to find the topics you were interested in. I'd love to learn how others are handling Google feeds. I've really struggled with trying to get the correct and current info from the cart to Google for a long time now - I'm currently uploading local inventory MANUALLY. The cart should be able to do this.

    1
    Comment actions Permalink
  • Avatar
    Joshua Artman

    We also built our own feed that queries the API for the data we need and submits that to Google.

    1
    Comment actions Permalink
  • Avatar
    Kathy Sechrist

    Joshua - Would you be willing or able to share how you did that? I wouldn't blame you if you don't want to, but it doesn't hurt to ask!

    0
    Comment actions Permalink
  • Avatar
    Joshua Artman

    Hi Kathy,

    We have a separate PHP web server on which I created a script over 5 years ago that makes requests to the AmeriCommerce API for the data we want to send to Google. We have tweaked it quite a bit so the actual script is pretty complex now, but once we have the data compiled that we want to send to Google, the script saves that data to an xml file, and then auto uploads that file to the Google FTP server.  The script is auto triggered on our PHP server every night, so we update Google Products daily. Since I created the process Google has added the ability to send the data directly to the Google Shopping API, so we would not need to be uploading the xml file to Google's FTP server any more. I have thought about updating our script to use the Google API, but it is working as is, so for now we have elected to leave well enough alone.

    The AmeriCommerce built in Google Feed just did not have the flexibility for what we needed, and we did not want to have to fill in all of those Google Feed Fields in each and every product. It would also be nice if the Google feed fields in the product editor were in their own tab rather than just tacked on the end of the list of custom product variables.  For our purposes, we needed to use some logic to determine what gets provided to Google, sort of like what is available for site wide product titles and meta information but we needed more logic capabilities to work for us. For example, we sell car parts and use the product status to report to Google if the product is New, Used or Restored product.  We use the attributes to list the applications that a part fits, so we take the applications attribute and append the list of cars it fits to the description provided to Google. We dynamically watermark our images shown on our website, but we can not have the watermark on the images sent to Google, so we append a variable to the images sent to Google, so when Google requests the images the watermark is not added. We actually have quite a few more tweaks to the data, but that gives you an idea.  With our current setup we do not use the Google Feed Fields in the product settings on AmeriCommerce at all.  We use the fields displayed to the customer and logic to determine how we format what is provided to Google. 

    The current Google Feed integration on AmeriCommerce feels like a half finished afterthought.  It would need to be streamlined and offer more flexibility for it to be a viable option for us to use.

    1
    Comment actions Permalink
  • Avatar
    Kathy Sechrist

    Joshua - THANK YOU.

    I found this and got it working to return prices (now I'm working out how to get this into a usable file) :

    https://github.com/AmeriCommerce/rest-api/blob/master/examples/php/single_token/single_token.php

    But my priorities have switched - I now need current inventory asap. So I tried to change the file to use the inventory endpoint, but everything I've tried either results in errors, or I get a blank page. I can't find any useful info to help me retrieve inventory count. Do you know of any?

    0
    Comment actions Permalink
  • Avatar
    Joshua Artman

    Hi Kathy,

    Sorry for the delay in my response. 

    Not sure if you got it figured out, but I use the Products resource to grab the current inventory numbers:

    https://github.com/AmeriCommerce/rest-api/blob/master/resources/products.md

    quantity_on_hand

     

    If you need to grab variant inventory numbers:

    https://github.com/AmeriCommerce/rest-api/blob/master/resources/products.md#variant_inventory

    inventory

    Hope that helps.

    1
    Comment actions Permalink
  • Avatar
    Kathy Sechrist

    THANK YOU JOSHUA!!

    I've been spinning my wheels on this for so long with nothing to show for it, that I finally took a break. But I'm ready to make another stab at it. I will check that out!

    0
    Comment actions Permalink
  • Avatar
    Kathy Sechrist

    YAY!  I actually got that to work and it pulled 100 products with inventory counts into a csv file for me.

    Now off to figure out how to filter and only pull the items I want, plus break that 100 count limit.

    I have SO much to learn (I've almost no experience with APIs) so I really appreciate the help you've given. I would have never gotten this far without it.

    0
    Comment actions Permalink
  • Avatar
    Joshua Artman

    Hi Kathy,

    You are very welcome.  Let me know if I can be of further assistance.

    Here is an example of how I am getting our complete list of products via the API.  I use a while loop:

    //Get data set from AC
    $url="https://" . AC_STORE_DOMAIN . "/api/v1/products/?fields=id,item_number";


    //initial setting for while loop
    $more_pages=true;
    $next_page=$url;
    $items=[];
    while($more_pages==true){
    $response=get_ac_data($next_page,1234); //I have the AC lookup in a separate function
    $items=array_merge($response['products'],$items); //combine returned results with any results received in a previous lookup

    if(isset($response['next_page'])&& $response['next_page']!=""){ //if AC returns that there is another page of results
    $next_page=$response['next_page']; $more_pages=true; sleep(1);} //set the next_page and more_pages variables for the next loop, and pause for 1 second to not exceed lookup limits
    else{ $more_pages=false;}
    unset($response);
    }

    Hope that helps point you in the right direction.

    1
    Comment actions Permalink
  • Avatar
    Kathy Sechrist

    Joshua, you have been incredibly kind to offer so much help to a stranger. I truly appreciate that!

    I've got this page bookmarked!

    I'm currently getting ALL the data I need into a file - YAY!  My final challenge is to get that file formatted the way google wants it. I'm ecstatic that I made so much progress on this today. THANK YOU.

    0
    Comment actions Permalink
  • Avatar
    Kathy Sechrist

    To Americommerce:
    I finally got all of this working with the API, and it's feeding to Google, BUT...

    I am desperately missing fields - especially the GoogleExclude field. Right now it's feeding ALL of my products to Google, and I only need about half of them. I even searched for a way to filter this using a different field, such as one of the empty Description fields, but if this is a complete list of available fields, I'm at a loss:
    https://github.com/AmeriCommerce/rest-api/blob/master/resources/products.md

    0
    Comment actions Permalink
  • Avatar
    Joshua Artman

    Hi Kathy,

    I am not sure if you got this figured out, but it just occurred to me that I think all of the Google Feed fields are under the Products Custom Fields.  So those should be able to be accessed by using (https://github.com/AmeriCommerce/rest-api/blob/master/resources/products.md#custom_fields):

    /api/v1/products?expand=custom_fields

    Or for an individual product:

    /api/v1/products/{id}/custom_fields

    This will include the list of all of the custom fields for your product, then you can include/exclude items based upon the custom field value. 

    Hope that helps.

    0
    Comment actions Permalink
  • Avatar
    Kathy Sechrist

    Thank you Joshua!

    I have got a lot working the way I wanted... but a few more things to hammer out (like sale price) so I will definitely check it out.

    0
    Comment actions Permalink
  • Avatar
    Joshua Artman

    The sale price gets a bit complicated depending on how the price is determined.  For example, are you using discount / coupons for the sale prices or are you just setting a sale price in the pricing tab of the product.  If you are just using the pricing tab, then those prices can be access via expanding pricing (https://github.com/AmeriCommerce/rest-api/blob/master/resources/products.md#pricing):

    GET /api/v1/products?expand=pricing

    So to include the custom fields and the pricing in your lookup you would need:

    GET /api/v1/products?expand=pricing,custom_fields
    0
    Comment actions Permalink
  • Avatar
    Kathy Sechrist

    I'm using discount rules. This way it shows the sale price on the product page without me needing to do anything else.

    0
    Comment actions Permalink
  • Avatar
    Joshua Artman

    That definitely complicates getting the sale price.  You can access the discounts (https://github.com/AmeriCommerce/rest-api/blob/master/resources/discount_methods.md), but I don't think currently there is any way to get the system to tell you whether any given discount rule applies to a given product.  So you would have to somehow determine if any of the active discounts applied to a given product, then apply the discount to the sale price you report to Google.

    AmeriCommerce system offers a lot of ways to put a product on sale, and you could have dozens of prices for the same item based upon different criteria.  That makes it very complicated to pull a given sale price.

    Probably not the answer you were hoping for. 

    0
    Comment actions Permalink
  • Avatar
    Kathy Sechrist

    I truly appreciate all the help you have given.

    It's just frustrating that the cart can use the discount rule to calculate final price - which is what I'd like to show in Google as the Sale Price, but Google is calling it a "price reduction" instead!

    Here's the code I have on the product page to get the final price:

    <div id="dvProductPricing" class="ProductDetailsPricing pad-10 no-pad-t"> 
    <div>$$RETAIL$$</div>
    <div>$$WASPRICE$$</div>
    <div class="h1">$$PRICE$$</div>
    <div>$$YOUSAVE$$</div>
    <div>##PAYPALPRODUCTPROMOTION##</div>
    <div>##AFFIRMPRODUCTPROMOTION##</div>
    <div>$$MAPPRICINGLINK$$</div>
    <div>$$DISCOUNTLIST$$</div>
    <small>
    <div>$$REWARDPOINTSTOPURCHASE$$</div>
    <div>$$REWARDPOINTSEARNED$$</div>
    <div>$$BONUSREWARDPOINTSEARNED$$</div>
    </small>

    </div>

    And here's code I added to the bottom of the page trying to make Google happy with another scenario (I think I was struggling with rich snippets) - maybe this is where the problem lies?  Either way, it seems like I should be able to grab one of these and submit it as the Sale Price??

     <div>
    <div>Item Name: ##PRODUCTNAME##</div>
    <div>Item Number: ##ITEMNR##</div>
    <div>Item Price: $##RAWPRICE##</div>
    </div>

    See image for how the cart displays the product price - which is exactly what I like and want to keep.

    0
    Comment actions Permalink

Please sign in to leave a comment.

We're Here To Help


Standard Support Hours: Monday-Friday 8AM-6PM CST
Looking for Premium Support? Just ask!

Speak to a live person
1 (800) 936-9006
Submit A Support Ticket
Submit Your Ticket Here