Ruby Racer
Ruby Racer

Reputation: 5740

Facebook ads - Products feed - Multiple shipping zones setting

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)?

Upvotes: 0

Views: 952

Answers (2)

Ahmet Aydın
Ahmet Aydın

Reputation: 1

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');

Upvotes: 0

Ruby Racer
Ruby Racer

Reputation: 5740

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>

Upvotes: 1

Related Questions