davidtsadler / ebay-sdk-examples

Several examples of using the eBay SDK for PHP
http://devbay.net
Apache License 2.0
184 stars 100 forks source link

Ebay require EAN #38

Closed IngegnereMatto closed 7 years ago

IngegnereMatto commented 7 years ago

I'm using this sample:

https://github.com/davidtsadler/ebay-sdk-examples/blob/master/trading/06-add-an-item-with-multiple-variations.php

to add products with variations on ebay, but EAN is required. Is there a way to add EAN code to products with variations? I Have to specify EAN for each variations or only for the 'Main product' (All my variations have same EAN)?

davidtsadler commented 7 years ago

To add an EAN to the 'main product' use the Item.ProductListingDetails.EAN field.

$productDetails = new Types\ProductListingDetailsType();
$productDetails->EAN = '...';
$item->ProductListingDetails = $productDetails;

To add an EAN to each variation use the Variation.VariationProductListingDetails.EAN field.

$productDetails = new new Types\VariationProductListingDetails();
$productDetails->EAN = '...';
$variation->VariationProductListingDetails = $productDetails;

I've not tried the above code so you may have to adjust it in order for it to work.

Be aware that eBay will be changing how product identifiers are specified. The documentation has notes on the current method and the future method.