How to Sync WooCommerce Product Images using API

woocommerce-product-image-sync

Syncing images in iPaaS solutions has always been a challenge. The only old school way is to upload the required images in a server, map the image URLs with the associated items and then update the items. Even though you have an enterprise automated solution, there always remains a pinch of a manual task to do. There should be a solution in where there is no room for manual job even in case of uploading images.

Syncing Product Images in WooCommerce

If you want to upload images to WordPress, you need to use the WordPress media API to upload and attach a media to a post. But sometimes it becomes a nightmare to use proper authentication to access the WordPress media API. Now, in case you decide to upload images for WooCommerce products using the same API, you need to use two formats of APIs with two types of authentication, one for WordPress and another for WooCommerce, which is really challenging in case you are syncing data between two applications.

With B2BeCONNECT for WooCommerce, now you can easily upload images and associate them with products using the same WooCommerce API and authentication. Not only you can associate an image to a product while uploading the media, but you can also attach multiple images to a product using the same API.Integrated-B2B-eCommerce-store-InSync

Given below is a blueprint of how the API works to upload an image for WooCommerce.

API URL: (your website link)/wp-json/wp/v3/media

Date packet to be sent:

{
"media_attachment": “/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAoHBwgHBgoICAgLCgoLDhgQDg0NDh0VFhEYIx8lJCIfIiEmKzcvJik0KSEiMEExNDk7Pj4+JS5ESUM8SDc9Pjv/2wBDAQoLCw4NDhwQEBw7KCIoOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozv/wgARCAG4Au4DASIAAhEBAxEB/8QAGwABAAIDAQEAAAAAAAAAAAAAAAECAwUGBAf/xAAaAQEAAwEBAQAAAAAAAAAAAAAAAQIDBQQG/9oADAMBAAIQAxAAAAHswAAAAAAAAAAAAAAAAAAAAEeKLe3Dyvgz6HbZuCtF+”,

"name": “Image.jpg”,

"media_type": "image",

"mime_type": "image/jpeg",

“product_id”:32
}

All the fields are self-explanatory. In the ‘media_attachment’ you need to send the Base64 format of the image. There are many websites to convert images to the Base64 format.

If you are using APPSeCONNECT to sync data between WooCommerce and other business applications like ERP, CRM, this API is like a cakewalk to sync images for products using the same version of WooCommerce APIs.

Integrate-Business-Apps-through-APPSeCONNECT

That’s how you can easily sync product images in WooCommerce!

Thank you.


InSync Tech-Fin Solutions offers a smart Integration Platform as a Service (iPaaS) solution – APPSeCONNECT, which connects multiple applications together and streamlines complex business processes. We also provide integrated B2B eCommerce solutions – B2BeCONNECT for platforms like Magento, Shopify, WooCommerce, etc. to help organizations delight their business buyers with robust B2B features.

Get started with your B2B eCommerce store and gain a competitive edge in the market! Also, connect all your business applications under one single platform to automate the business process!

Integrated-B2B-eCommerce-store-InSyncYou may also like:
InSync boosts Productivity and Improves Collaboration through Microsoft Teams
26 Amazing Productivity Tools For Remote Working
WooCommerce 4.0 Released – All You Need to Know

Soumitra Chakraborty

I am a technical consultant cum blogger.