WordPress

Upload and download products from WordPress WooCommerce

WooCommerce Connector installation

WooCommerce connector supports product download and upload. This article explains how plugin configuration works.

Always make a backup of your existing store before making product imports / exports on LIVE website. Best practice is to perform testing on STAGING version of your site and then apply them on LIVE.

The following options are to be done on the WooCoommerce side.

A plugin is tested and working with PHP 8.0 and versions from Wordpress 6.3.1 to Woocommerce 8.1.1.

Plugin Installation

Upload plugin to your WordPress site and activate it.

Add a CRON tabs. It is recommended to be executed every 2 minutes, but can be every 5 or 10 minutes as well:

# WISEXML HEARTBEAT
*/2 * * * * php {path_to_document_root}/wp-content/plugins/wisexml-connect/heartbeat.php > /dev/null

Replace {path_to_document_root} with path of your website's location on the server.

Heartbeat is like a scheduler - it is a generic task to see what the Connector plugin has to perform. You will not be able to import products without having Heartbeat CRON running.

All tasks (especially product import) are asynchronous - this means that every heartbeat this plugin will only process certain amount of products, but not all. If you set this CRON to be executed for example one every hour, it might take very long before all products are imported to your store. To sum up - the more frequent CRON is, the faster the import / update of products go.

Do not use wget, cronurl or similar commands. Heartbeat has to be executed from your server. Otherwise, your website might not be accessible for your visitors when Heartbeat is running.

Updating the Plugin

If you already have plugin installed and want to update to newest version:

  1. Go to WordPress Dashboard Plugins page.
  2. Deactivate and remove Wise2Sync Connect plugin.
  3. Upload new plugin version by clicking button "Add new" and then "Upload plugin".
  4. Wise2Sync Connect plugin should be visible in the plugins list now. Click "Activate it" to enable plugin.
Configuration

General configuration is located in Admin panel under Wise2Sync → Wise2Sync Settings.  Alternatively, you can access it by navigating to WooCommerce → Settings → Wise2Sync. To configure import or export create import or export profile accordingly. See Setting up product import from Wise2Sync to WooCommerce and Setting up product export from WooCommerce to Wise2Sync  pages for detailed descriptions of each profile.

General settings (located under Wise2Sync → Wise2Sync settings)
Available Shell commands (via shell.php)

Delete all tasks:

shell.php --deletetasks

Run next task in queue:

shell.php --runnexttask

Removes all ever imported Wise2Sync products and product images from website (test it first before executing on LIVE website):

shell.php --removeall

Setting up product import from Wise2Sync to WooCommerce

WooCommerce connector supports product export and import. This article explains how to import products from Wise2Sync to your store.

Wise2Sync configuration

After you have logged in to your https://app.wise2sync.com/ account, navigate to "Export profiles". Create an export profile with the filters and repricing rules for the products that you want to push to your WooCommerce platform. Configure export profile fields according to the following example:

WooCommerce export profile settings

Important: "Unique Product ID" must be set as "SKU" and "Output format" must be as "CSV/TXT".

 

Then navigate to the "Template" tab and add the required elements (they will be columns in the CSV file). The following columns are required:

Column name Description
SKU Product SKU
name Product name
price Product regular price
qty Product stock quantity
category_id Category ID in WooCommerce (after you map your categories)
group_id

Product group id (required only for configurable products)

media_gallery/filename

Product images

Please note: SKU should be a unique Product ID.

You can also add more columns to the export template:

Column name Description
description Product description
short_description Product short description (excerpt)
special_price Sale price (must be less than price, otherwise price attribute value will be visible only. If the sale price is less than the price it will be visible as the final price, discounted, initial price crossed out)
weight Weight in kg (decimal)
length Length in cm (decimal)
width Width in cm (decimal)
height Height in cm (decimal)
purchase_note A note sent to the customer after purchase
comment_status Allow reviews for product (allowed values: yes/no)
sold_individually Enable this to only allow one of this item to be bought in a single order (allowed values: yes/no)
virtual Virtual product – not shipped (allowed values: yes/no)
downloadable Downloadable product (allowed values: yes/no)
Attributes/{attribute_label} Product attribute. Multiple values are semicolon-separated.
Taxonomies/{taxonomy_slug} Import this field as custom taxonomy, for example, Brand
Metafields/{metafield_key} Import this field as metafield
tags Comma separated tags

Your export profile template could look similar to this:

export-profile.jpg

After you are done customizing your template, click Save and go back to the export profiles list. Click the "Queue" icon to generate the export file (CSV):

On demand export

Once the status turns back to "Completed" - the export file should be ready (check the Export results in your export profile and compare this sample CSV file).

Congrats, now you have prepared export profiles in the Wise2Sync account.

Connector configuration

The following options are to be done on the WooCoomerce side after you have installed Wise2Sync connector.

Always make a backup of your existing store before making product imports/exports on LIVE website. The best practice is to perform testing on STAGING version of your site and then apply them on LIVE.

Having configured profile on Wise2Sync it's tme to connect it with Woocommerce. Navigate to Wise2Sync -> Import Profiles and click "New import profile" button on top of the page. Fill in profile title and configuration fields. 

Import profile settings

 

image-1696575478218.png

image-1696575391032.png

image-1696575444896.png

Once all fields are filled click "Publish" button on top right corner of the page to create profile.

 
Import batch size and time out

Module imports a limited amount of products (batches) per single heartbeat. Batch size determines maximum amount of products per batch and batch time out limits maximum execution duration of a batch. Both settings act as measures to avoid overloading and possibly crashing website.

Regarding batch size setting, It should be set to average amount of products server is capable to update (not create) per heartbeat.

Regarding batch time out setting, our recommendation is to set it slightly lower than heartbeat execution interval. For instance, if heartbeat is set to run every 5 minutes, set batch time out to 4 minutes (240 seconds). If configured correctly, this setting keeps server load to the minimum by preventing from multiple batches running concurrently and allows website (server) to rest before next heartbeat.

It is important to understand that batch size and time out values must be fine tuned based on server capabilities. If batch size is set too small - heartbeat will finish too soon and remain in resting state until next heartbeat. For instance, server is capable to create 20 products per 2 minutes, CRON heartbeat is executed every 2 minutes, but time out is set 1 minute. Such configuration results in only 10 created products per heartbeat (2 minutes). To find out optimal  settings, perform product import in development mode and check how fast products are created/updated in your shop. For details, check import task message log (click on the import task in Task Manager). Here you can check how long batches take to execute and if time out occurs. Keeping in mind that timeout should never exceed heartbeat execution interval based on the outcome do the following:  If time out constantly occurs, lower time out or batch size setting. On the other hand, if batches execute too fast, increase time out or batch size setting. 

 

Import modes

"Create new and update existing products". This mode will create new products and update existing products. Any manual product modifications will be overwritten.

"Only create new products". This mode will only create new products.

"Only update existing products".  This mode will only update already existing products.

"Create new products/update prices and stock". This mode will only change the price and stock of the products. It will not change the pictures that you uploaded or any translations that you have made in your description.

"Update only selected fields". This mode allows to update only selected product fields and attributes. New products will not be created when using this mode.

woo-update-fields.jpg

When this mode is selected, following fields will be configurable:

"Create new products/Update only selected fields". This mode allows to update only selected product fields and attributes and create new products.

Other settings in Wise2Sync →Wise2Sync settings

 

"Deferred image thumbnail generation" (on / off). If products have large number of images import will run slow. Enabling this setting will defer image thumbnail generation for later making import faster. NOTE: As a consequence images will start appearing later after product is imported.

"Skip thumbnail generation". Select which intermediate image sizes (thumbnails) are not needed. Make sure to select sizes which are not used anywhere in website pages. Use this setting only if you know what you're doing.

 

Import Tasks

Located in Wise2Sync → Tasks.

Tasks are key elements in the Wise2Sync plugin. Import and export processes are encapsulated in tasks. Tasks allow monitoring processes and logging error messages.

Features:

Setting up product export from WooCommerce to Wise2Sync

In this article, we will explain how you can configure your Wise2Sync connector to export products to Wise2Sync. This is done after you have installed the extension - make sure you've set up a CRON.

Once you install the Wise2Sync module go to Wise2Sync -> Export profiles and create a new export profile:

The access token will be generated automatically. 

Click to generate your report immediately. Once this is done - copy the export URL to the clipboard and paste it in your browser.

7ovwise-wc-export-profile.jpg

If all is good - your browser will download your products feed file.

Definitions Explained
Export filters

* equal to or greater than a specified value

When the export file is deleted, all related tasks and export files are deleted as well.

You can also go to Wise2Sync → Export files to view and download the generated export files.

Importing Tags to your WooCommerce

Wise2Sync WooCommerce connector has the functionality to add tags to your product in the WooCommerce. Below you can find three steps, how to manage your Wise2Sync Export profile for importing tags.

1. Create a new Dynamic Attribute.

In your Wise2Sync account, create a new Dynamic Attribute. More information about Dynamic Attributes here.

tags-dynamic-attribute.png

After creating the "Tags" attribute, add value, and conditions for those tags.

add-value-to-dynamic-attribute.png

In the Value field, write all needed tags separated by comma or semicolon. The tags can start with the lower-case or upper-case. Add as many tags as you need. Tags will be sorted to WooCommerce in alphabetical order. If you need tags for a few categories (or conditions), create as many values as you want. 

Dynamic attributes - tags

2. Edit your Export profile

Go to Export Profiles → Select your export profile → in the Template tab add a new Tags element:

add-new-element.png

When you add the "Tags", you can Save your Export profile. More information about Export profiles here.

3. Import your products to WooCommerce

The last step is to start the import of your products into WooCommerce. Once the import is complete, your products will have Tags. 

Note: when you want to edit uploaded products in WooCommerce choose Import mode: "Create new and update existing products".

WooCommerce categories mapping

To map the product categories you will have to create your categories list in the WooCommerce plugin.

Step 1. Create your Category list in Woocommerce

First, you need to create categories in WooCommerce. Go to Products → Categories and click "Add new category".

WC-products.png

Before you start - review this article to understand how category mapping in Wise2Sync works.

Step 2. Get WooCommerce Category ID

Once you created your categories, you'll need to map them with the categories in Wise2Sync. You can find a Category ID in the WooCommerce  URL. In Products → Categories and open a category. See the URL, which holds the category ID (in this example, ID is 16):

https://yourdomain.com/wp-admin/term.php?taxonomy=product_cat&tag_ID=16&post_type=product

Step 4. Create Categories in Wise2Sync

Open Wise2Sync connector  https://app.wise2sync.com

Navigate to Data mapping → Category mapper → My categories and click "Add Category". A pop-up will open with two fields:

ID - enter the Category ID we copied in Step 1 ("16" in our case)
Label - the name of the Category (it can be the same as the Category name in Woocommerce.

image-1599054856992.png

You can repeat these steps multiple times for all categories. Or first create all categories in WooCommerce and then recreate them in Wise2Sync.

Step 5. Map supplier categories in Wise2Sync

Navigate to Data mapping → Category mapper → Supplier categories and map your newly created category with the supplier's category.

image-1599054943482.png

Repeat the steps above to map all your products' categories.

If you are not sure how the categories mapping works get in touch and we will help you! Contact us at support@wise2sync.com

WooCommerce connector troubleshooting

Products will not import / update if you do not have Heartbeat CRON running.
See installation page how to set up Heartbeat CRON.

Once you have some Wise2Sync plugin tasks, you will see a message, when the last Heartbeat was executed.
If you set the CRON to be executed every 5 minutes, then the last Heartbeat should be no more than 5 minutes.

ntkwoo_commerce_running_cron.png

If you see that Heartbeat was never executed or it was executed very long time ago - this means that CRON is not running. Contact your server administrator or developer for assistance on setting up CRON.

Getting "code: error, message: Empty response" after validating API access token (applies to module versions 1.3.1 and lower)

Usually, the problem occurs when the cURL library is not enabled on your server. This means that your e-shop can not establish a connection with the Wise2Sync https://app.wise2sync.com.

Empty response

Solution: enable PHP cURL library in your server and the problem should be gone.

 

Debug.log file taking up the disk space

You may have debugging enabled in WordPress configuration.

1. Access your website file system via FTP client and edit wp-config.php file which is located in website root folder and look for line "define('WP_DEBUG', true);".  Set to false, like this:

define('WP_DEBUG', false);

2. Save the modified file.

3. debug.log now can be removed and it won't be generated anymore.

 

What is important if i want to import large quantities of products to my shop?

We recommend having a server with CLI access. CLI (command line interface) access is not required only if you are running a small e-commerce shop and are going to export / import small amounts of products. Product Export or Upload is resource intensive - and these tasks should be executed from CLI. If you do not have CLI access or the possibility to execute commands from the console, then you can use a HTTP-based cron command. It will work if you do not have many products. It is also slower.

Woocommerce export/import troubleshooting (tips)

Products are not exporting or importing as expected

In some cases, you will have a situation when products do not import or export as expected. We advise you to read this article and follow simple steps to eliminate the problem.

Products are not being imported.

Images not being imported.

Product Attributes not being imported.

If certain attributes present in the Wise2Sync profile are not imported,  please check the following.

Certain product fields not being imported.

Refer to https://docs.Wise2Sync.com/books/connectors/page/setting-up-product-import-from-Wise2Sync-to-woocommerce article and ensure Wise2Sync Export profile template is configured correctly.

Variable products not imported or imported as simple products.

Ensure group_id field is present in the Wise2Sync Export profile template.

Missing products in the export file.

Missing fields or attributes in export.

We hope these tips will help you and if you still need some assistance do not hesitate to drop us a line at  support@wise2sync.com