Facebook ads - Products feed - Multiple shipping zones setting

916 Views Asked by At

I'm writing a feed from an e-shop, to give to facebook.

So far so good. The feed is in XML format, and the reference provides a sample, and the format for the shipping field in the item, within the feed, is:

<g:shipping>
    <g:country>UK</g:country>
    <g:service>Standard</g:service>
    <g:price>4.95 GBP</g:price>
</g:shipping>

However, the reference states that the format should be a comma-separated string, like this:

Blob with different prices for each country and region. 
Different regions are comma-separated. 
The format should be COUNTRY:STATE:SHIPPING_TYPE:PRICE.

e.g.

US:CA:Ground:9.99 USD, US:NY:Air:15.99 USD

Do you catch the contradiction?

If I try in my feed:

<g:shipping>US:CA:Ground:9.99 USD, US:NY:Air:15.99 USD</g:shipping>

I get errors, that country or price is missing.

So, I will have to stick to the sample.

The question is:

Which is the right way to provide multiple shipping zones in the feed?

The debugging tool here is not helping at all...

Do I repeat the g:shipping fieldset?

<g:shipping>
    <g:country>UK</g:country>
    <g:service>Standard</g:service>
    <g:price>4.95 GBP</g:price>
</g:shipping>
<g:shipping>
    <g:country>US</g:country>
    <g:service>Standard</g:service>
    <g:price>5.30 GBP</g:price>
</g:shipping>

Do I iterate within the fieldset?

<g:shipping>
    <g:country>UK</g:country>
    <g:service>Standard</g:service>
    <g:price>4.95 GBP</g:price>
    <g:country>US</g:country>
    <g:service>Standard</g:service>
    <g:price>5.30 GBP</g:price>
</g:shipping>

Or what, if anything, do I have to do to have multiple zones, before switching to CSV (which I don't want to do, but I will if I have to: CSV supports the comma-separated format for multiple zones)?

2

There are 2 best solutions below

1
Ruby Racer On BEST ANSWER

I'm answering this here for future reference.

The template used by Facebook is the one provided by Google Merchant Center.

As stated here

Include the optional sub-attributes if you need them. 
To specify a shipping cost for different delivery locations, 
submit multiple shipping attributes including the relevant sub-attributes.

<g:shipping>
  <g:country>US</g:country>
  <g:region>MA</g:region>
  <g:service>Ground</g:service>
  <g:price>6.49 USD</g:price>
</g:shipping>
<g:shipping>
  <g:country>US</g:country>
  <g:region>MA</g:region>
  <g:service>Express</g:service>
  <g:price>15.99 USD</g:price>
</g:shipping>
0
Ahmet Aydın On

For anyone gets warnings about shipping_price_value, shipping_price; If you are using php and SimpleXMLElement add xmlns:g: to define xml namespace otherwise facebook throws warnings.

Interestingly this only affects shipping fields.

$shipping = $item->addChild('xmlns:g:shipping');
$shipping->addChild('xmlns:g:country', 'TR');
$shipping->addChild('xmlns:g:service', 'Karayolu');
$shipping->addChild('xmlns:g:price', '14.90 TRY');