Import from eBay API – Hooks and Filters

The Import from eBay to WooCommerce plugin features various filter hooks to allow complete control over how products are imported. These can be used by third party developers as well as our support team in order to customize the result in special use cases.

wplister_ebay_import_skip_item

This filter allows you to control whether an eBay listing should be imported or not. Inspect the original eBay $Item object or the processed $data array to decide if $skip_item should be set to true.

Usage:

add_filter('wplister_ebay_import_skip_item', 'my_filter_ebay_import_skip_item', 10, 3 );
function my_filter_ebay_import_skip_item( $skip_item, $data, $Item ) {

    // do not import eBay item 123456789
    if ( $Item->ItemID == '123456789' ) $skip_item = true;

    // only import items with condition "New" (ConditionID 1000)
    // for other IDs see http://developer.ebay.com/devzone/finding/callref/Enums/conditionIdList.html
    if ( $Item->ConditionID != 1000 ) $skip_item = true;

    return $skip_item;
}

wplister_ebay_import_processed_description

Modify the item description after processing. The import plugin first applies cut in and cut out points, then strips disallowed HTML tags and performs any search and replace actions. If you want to process the description before these actions take place, use the wplister_ebay_import_raw_description filter.

Usage:

add_filter('wplister_ebay_import_processed_description', 'my_filter_ebay_import_description', 10, 2 );
function my_filter_ebay_import_description( $description, $Item ) {
    // do something to $description here...
    return $description;
}

wplister_ebay_import_raw_description

Modify the raw, unprocessed HTML item description before the plugin performs any cutting or search and replace actions.

Usage:

add_filter('wplister_ebay_import_raw_description', 'my_filter_ebay_import_description', 10, 2 );
function my_filter_ebay_import_description( $description, $Item ) {
    // do something to $description here...
    return $description;
}

wplister_ebay_import_product_data

Modify any product detail after processing but before importing to WooCommerce.

Usage:

add_filter('wplister_ebay_import_product_data', 'my_filter_ebay_import_product_data', 10, 2 );
function my_filter_ebay_import_product_data( $data, $Item ) {

    // modify $data fields...
    $data['name'] .= ' - ' . $data['ebay_id']; // append eBay ID to product title
    $data['price'] = $data['price'] * 1.1;     // increase price by 10%

    // add custom product attribute
    $attrib = new stdClass();
    $attrib->name  = 'My Attribute';
    $attrib->value = 'Hello World';
    $data['attributes'][] = $attrib;

    return $data;
}

wplister_ebay_import_after_add_product

Do something after a new product has been created in WooCommerce.

Usage:

add_action('wplister_ebay_import_after_add_product', 'my_action_ebay_import_add_product', 10, 2 );
function my_action_ebay_import_add_product( $post_id, $data ) {
    // do something to the new WooCommerce product...
    update_post_meta( $post_id, '_visibility', 'hidden' ); // hide product
}

wplister_ebay_import_after_add_listing

Do something after a new listing has been created in WP-Lister.

Usage:

add_action('wplister_ebay_import_after_add_listing', 'my_action_ebay_import_add_listing', 10, 2 );
function my_action_ebay_import_add_listing( $listing_id, $data ) {
    // do something to the new listing in WP-Lister...
    $lm = new ListingsModel();
    $lm->updateListing( $listing_id, array('status' => 'changed'); // mark as changed
}

Note: These hooks are available since version 1.3.35.