woocommerce-products-xml-feed

WooCommerce Products XML Feeds

WooCommerce products XML feeds

Description

WooCommerce Products XML Feeds lets you create all your shop’s products XML file.

XML is fully customizable, with options to set XML header, item and footer templates.

When creating item template, we advise to use Booster’s products shortcodes

You can set result XML file path and name

File can be created manually, or automatically by selected update rate (every minute, hourly, twice daily, daily and weekly).

Additionally you can create multiple XML files with different templates, path, name and update rate.

woocommerce-products-xml-feed-admin-settings

If you need to use CDATA in feed, you may need to replace symbols with HTML codes, e.g.:

<title>wcjproducttitlebefore“&#60;!&#91;CDATA&#91;”after“&#93;&#93;>”</title>

This will be outputted in your feed something like:

<![CDATA[Some Product Title]]>

If you need to include shortcode in tags double quotes, use:

<item id=&quotwcjproductidquot</item>

This will be outputted in your feed something like:

<item id="123"></item>

HTML entities are replaced in all (header, footer, item) fields, so:

ltitemdate<43-08:00am12><43-08:00am12><43-08:00am12><43-08:00am12><43-08:00am12><43-08:00am12>“gt

will be outputted in your feed as:

<item date="2018-09-04 12:42:57">

If you have some specific requirements, you can also create your custom shortcodes to be used in feeds. For example try putting this to your (child)
theme’s functions.php file:

add_shortcode( 'alg_product_price_multiplied_by_stock', 'alg_product_price_multiplied_by_stock' );if ( ! function_exists( 'alg_product_price_multiplied_by_stock' ) ) {    function alg_product_price_multiplied_by_stock( $atts ) {        $product_id = get_the_ID();        $product    = wc_get_product( $product_id );        return ( ! $product->is_in_stock() ? 0 : $product->get_price() * $product->get_stock_quantity() );    }}

Now you can use it in your feed like:

<stock_price>[alg_product_price_multiplied_by_stock]</stock_price>

Accessible through:

  • WooCommerce > Settings > Booster > Products > Products XML Feeds

Tested on WooCommerce 4.0.0 and WordPress 5.3.2Plugin can be downloaded here. If there are any locked fields in the module, you will need to get Booster Plus to unlock them.

WooCommerce Booster ModulesWooCommerce Products XML Feed

#comment>

#comment>

#comment>#comment>#comment>

Leave a Reply Click here to cancel reply.

#comment>

Comments

25 Comments

  1. joody March 18, 2020 at 8:25 am#comment>

    what is the purpose of create the ” shop’s products XML file” please?
    it is not a sitemap could be accept by google? I thought it is for google index, but not.
    it is not a schema structure, looking forward to get any explanation

    Reply to thread

    #comment>#comment>#comment>Avatar#comment>

  2. #comment>

  3. Jan March 6, 2020 at 7:47 am#comment>

    Hello, how can i output product variations? I tried to use

    from here: https://booster.io/shortcodes/wcj_product_available_variations/
    but it shows table i need to set somtehnig like

    variant 1 name
    variant 1 price

    variant 2 name
    variant 2 price

    Reply to thread

    #comment>#comment>#comment>Avatar#comment>

    • Jan March 6, 2020 at 8:00 am#comment>

      I am sorry here is a desired output
      thanks in advance
      Jan

      #comment>#comment>Avatar#comment>

    • #comment>

    • Jan Brokeš March 6, 2020 at 8:01 am#comment>

      desired xml output https://snipboard.io/DFYvRq.jpg

      #comment>#comment>Avatar#comment>

    • #comment>

    #comment>

  4. #comment>

  5. quiquefranco69 November 26, 2019 at 11:13 am#comment>

    Hi. The XML file is void. Can you help me? Thanks

    Reply to thread

    #comment>#comment>#comment>Avatar#comment>

    • RokasJ November 27, 2019 at 6:38 pm#comment>

      Hi,

      Could you explain what do you mean by saying it’s void? Is it empty? Could you send your module settings to our email [email protected]

      Best regards,
      Rokas – Support Team

      #comment>#comment>Avatar#comment>

    • #comment>

    #comment>

  6. #comment>

  7. Tom November 9, 2019 at 8:25 pm#comment>

    Hello,

    can I set 2 names in the feed and only display one? For example,

    If has a paramater set, display it and ignore .
    If does not exist, display only . (this method already works)

    Use is common, for example, for comparators that accept their names. So I will send the name they want but I will have a different name on my site.

    I believe this is a very useful thing. Especially if the product names include the “luxury”, “elegant” and the like, which do not directly represent the product name.

    Many thanks
    BR

    Reply to thread

    #comment>#comment>#comment>Avatar#comment>

  8. #comment>

  9. Tom October 31, 2019 at 7:23 pm#comment>

    Hi,

    is it possible to set a shipping price based on product price in the feed? I would like to set a fixed amount of shipping for products with a price up to a certain amount. For example, for products up to € 80, shipping costs € 3, and for products over € 80, display 0 as free.

    BR
    Tom

    Reply to thread

    #comment>#comment>#comment>Avatar#comment>

    • RokasJ November 1, 2019 at 7:42 am#comment>

      Hi Tom,

      Unfortunately that is not possible yet but we have added it to our todo list.

      Best regards,
      Rokas – Support Team

      #comment>#comment>Avatar#comment>

    • #comment>

    #comment>

  10. #comment>

  11. Michael April 2, 2019 at 4:04 pm#comment>

    Hello.

    Consider adding in file

    includes/class-wcj-products-xml.php

    line 191

    ‘meta_key’ => ‘_stock_status’,
    ‘meta_value’ => ‘instock’,

    but in a variable format like the rest options you have so the user can select to filter only products that are in stock or not or both.

    Thank you.

    Reply to thread

    #comment>#comment>#comment>Avatar#comment>

  12. #comment>

  13. Tarmo July 19, 2018 at 12:03 pm#comment>

    Is there a way to skip an empty tag to be printed if there is no value.
    I have following snippet, but i need to skip the whole tag if is empty.

    photo
    ]>”]

    Reply to thread

    #comment>#comment>#comment>Avatar#comment>

    • RokasJ July 19, 2018 at 1:08 pm#comment>

      Hi Tarmo,

      Unfortunately this is not possible at the moment but we have added it to our todo list.

      Best regards,
      Rokas – Support Team

      #comment>#comment>Avatar#comment>

    • #comment>

    #comment>

  14. #comment>

  15. Jorge Santos June 23, 2018 at 2:52 pm#comment>

    Hi,

    you have a great plugin!

    But how i achieve, in the xml feeds for product,
    1. description in another language with wpml?
    2. Price in another currency?

    Don’t work.

    Thank you

    Reply to thread

    #comment>#comment>#comment>Avatar#comment>

  16. #comment>

  17. Zane May 29, 2018 at 4:15 am#comment>

    Hi
    Would like to create an XML file to have only the last 30 (or whatever period) products listed based on post_modified date. As this is for a Mailchimp campaign I don’t want all 5000 products being sent to them in an email.
    By being able to list by modified date this will enable me to narrow to the more recent active products for WooCommerce.
    Any help appreciated

    Reply to thread

    #comment>#comment>#comment>Avatar#comment>

    • Booster Support Team May 29, 2018 at 3:45 pm#comment>

      Hi,

      Wasn’t possible, but I’ve just made the required changes to the plugin. I found your Booster Plus order, so I’ve just sent you newest Plus dev version in another email. You will need to uninstall the old plugin version first (don’t worry your saved settings won’t disappear).

      Now in “WooCommerce > Settings > Booster > Products > Products XML Feeds” you will find new “Sort Products by”, “Sorting Order” and “Max Products” options for each XML file.

      Please let me know if that was what you needed. And if you like Booster, please leave us a rating, would really appreciate that.

      Best regards,
      Tom

      #comment>#comment>Booster Support Team#comment>

    • #comment>

    #comment>

  18. #comment>

  19. sulani March 2, 2018 at 3:09 am#comment>

    Hi,
    What are the settings for google feed/
    We submitted this feed and google rejected

    Reply to thread

    #comment>#comment>#comment>Avatar#comment>

  20. #comment>

  21. Diego January 9, 2018 at 1:49 pm#comment>

    Hi there, awesome plugin.
    How can i set a google friendly xml?
    Because i set some fields and shortcodes, but the google shopping has output errors…
    Thank you in advance.

    Reply to thread

    #comment>#comment>#comment>Avatar#comment>

    • Booster Support Team January 10, 2018 at 5:08 pm#comment>

      Hi Diego,

      Thanks.

      Could you please send me the exact format (i.e. shortcodes) that you are using, so I could check it on my test server (if you wish, you can send it to me privately to [email protected]).

      Best regards,
      Tom

      #comment>#comment>Booster Support Team#comment>

    • #comment>

    • Diego February 15, 2018 at 3:32 pm#comment>

      Hi there, i set this, but the output still wrong…

      #comment>#comment>Avatar#comment>

    • #comment>

    • Diego February 15, 2018 at 3:32 pm#comment>

      Hi there, i set this, but the output still wrong…

      <g:title></g:title>
      <g:link></g:link>
      <g:id></g:id>
      <g:condition>new</g:condition>
      <g:availability>in stock</g:availability>
      <g:brand>bichobichejo</g:brand>
      <g:price></g:price>
      <g:description></g:description>
      <g:google_product_category>
      <![CDATA[
      Apparel &amp; Accessories &gt; Handbags, Wallets &amp; Cases &gt; Handbags
      ]]>
      </g:google_product_category>
      <g:product_type>1604</g:product_type>
      <g:image_link></g:image_link>
      <category_full></category_full>
      <category_link></category_link>
      <g:material>Algodón Orgánico</g:material>
      <g:identifier_exists>true</g:identifier_exists>
      <g:shipping>5</g:shipping>

      #comment>#comment>Avatar#comment>

    • #comment>

    • Booster Support Team February 15, 2018 at 6:47 pm#comment>

      Hi Diego,

      I’ve tried your code on my server, and I’m getting “Namespace prefix g on title is not defined” errors. To solve this, you need to add <rss version="2.0" xmlns:g="http://base.google.com/ns/1.0"> to the “XML Header” option (in “WooCommerce > Settings > Booster > Products > Products XML Feeds”). Also you need to add </rss> to the “XML Footer”.

      So your header option should look something like that:

      <?xml version“1.0”<rss version“2.0”xmlns“http://base.google.com/ns/1.0”<root>

      and footer something like that:

      </root></rss>

      One more note – you are using shortcode. I would suggest adding strip_tags attribute, so it would be outputted without the WooCommerce tags, i.e.:

      ,

      and maybe also add hide_currency attribute, to show only the number, i.e.:

      ,

      Hope that helps.

      Best regards,
      Tom

      #comment>#comment>Booster Support Team#comment>

    • #comment>

    #comment>

  22. #comment>

  23. DJ November 8, 2017 at 9:24 pm#comment>

    Is there a way to parse out details from the description using keywords? I have year and manufacturer information inside a table in the product description and want to pull them into individual elements in my XML feed. Examle:

    YEAR

    2007

    MANUFACTURER

    BARKO

    MODEL

    595ML

    CONDITION

    USED

    STOCK NUMBER

    F000450

    HOURS

    14585

    LOCATION

    SC

    Reply to thread

    #comment>#comment>#comment>Avatar#comment>

  24. #comment>

  25. Ömer Fatih March 15, 2017 at 1:30 pm#comment>

    I am adding an image link using . This only adds one image. What should I do to add other images of my product?

    Reply to thread

    #comment>#comment>#comment>Avatar#comment>

    • Booster Support Team March 16, 2017 at 12:39 am#comment>

      Hi,

      I’ve replied to you privately, but in case you didn’t receive it:

      I’ve made some changes to the plugin, please download the development version here – http://booster.io/dev/. You will need to uninstall the old plugin version first (don’t worry your saved settings won’t disappear).

      Now I’ve added shortcode, which you can use in XML module, something like this:

      wcjproductgalleryimageurlimage_nr“1”strip_tags“yes”before“<image>”after“</image>”wcjproductgalleryimageurlimage_nr“2”strip_tags“yes”before“<image>”after“</image>”wcjproductgalleryimageurlimage_nr“3”strip_tags“yes”before“<image>”after“</image>”wcjproductgalleryimageurlimage_nr“4”strip_tags“yes”before“<image>”after“</image>”wcjproductgalleryimageurlimage_nr“5”strip_tags“yes”before“<image>”after“</image>”

      You should add maximum number of images possible (in image_nr) – if some product won’t have so many images, shortcode will just return empty result.

      Please let me know if it works as expected or if you have any questions.

      Best regards,
      Tom

      #comment>#comment>Booster Support Team#comment>

    • #comment>

    • Ömer Fatih March 16, 2017 at 2:21 pm#comment>

      I did the experiment, but there were some problems. Each line of products has a first picture, does not bring different pictures. Also, in products that only have one image, each split takes the same image.

      #comment>#comment>Avatar#comment>

    • #comment>

    #comment>

  26. #comment>

#comment>#comment>#comment>#comment>

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.

This site uses Akismet to reduce spam. Learn how your comment data is processed.