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.:

This will be outputted in your feed something like:

<![CDATA[Some Product Title]]>

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

This will be outputted in your feed something like:

<item id="123"></item>
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 );
if ( ! $product->is_in_stock() ) {
return 0;
} else {
return $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 3.3.5 and WordPress 4.9.5
Plugin can be downloaded here. If there are any locked fields in the module, you will need to get Booster Plus to unlock them.

Leave a Reply

Comments

10 Comments

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

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

    Reply to thread

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

      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 [wcj_product_gallery_image_url] shortcode, which you can use in XML module, something like this:

      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

      Booster Support Team
    • Ömer Fatih March 16, 2017 at 2:21 pm #

      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.

  2. DJ November 8, 2017 at 9:24 pm #

    Is there a way to parse out details from the description [wcj_product_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

  3. Diego January 9, 2018 at 1:49 pm #

    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

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

      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 tom@booster.io).

      Best regards,
      Tom

      Booster Support Team
    • Diego February 15, 2018 at 3:32 pm #

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

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

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

      <g:title>[wcj_product_title]</g:title>
      <g:link>[wcj_product_url]</g:link>
      <g:id>[wcj_product_id]</g:id>
      <g:condition>new</g:condition>
      <g:availability>in stock</g:availability>
      <g:brand>bichobichejo</g:brand>
      <g:price>[wcj_product_regular_price]</g:price>
      <g:description>[wcj_product_excerpt]</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>[wcj_product_image_url image_size="full"]</g:image_link>
      <category_full>[wcj_product_categories_names]</category_full>
      <category_link>[wcj_product_categories_urls]</category_link>
      <g:material>Algodón Orgánico</g:material>
      <g:identifier_exists>true</g:identifier_exists>
      <g:shipping>5</g:shipping>

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

      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:

      and footer something like that:

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

      [wcj_product_regular_price strip_tags="yes"],

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

      [wcj_product_regular_price strip_tags="yes" hide_currency="yes"],

      Hope that helps.

      Best regards,
      Tom

      Booster Support Team
  4. sulani March 2, 2018 at 3:09 am #

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

    Reply to thread