When integrating POS with WooCommerce, requires product synchronization between POS and WooCommerce. Sometimes after we successfully upload or want to check the synchronization of our products between POS and WooCommerce, we need to do a Scan Product to check the synchronization status updates.
When DealPOS accesses product data from WooCommerce, WooCommerce will provide a large amount of property data, this causes the Scan Channel for WooCommerce products on the marketplace.dealpos.app to be very long because many properties are not used and are also taken. Therefore we need to do the settings by inserting a few lines of code in the WooCommerce website. For detailed steps, you can check the steps below.
Step 1. Go to Appearance Menu, then Click Theme Editor
Step 2. Select and Edit Theme
Select the theme you want to use, then click edit theme Function (function.php).
Step 3. Insert the Code
You can copy the code from here :
/*
* Add fillter to adjust webhook/api response when get all product from Marketplace Integration.
* References: https://stackoverflow.com/questions/56678243/how-to-fetch-specific-json-field-from-woocommerce-rest-api
/* This function will have 2 workarounds
* 1. You can get spesific fields by adding parameters (products?per_page=100&page=1&fields=id,name)
* 2. You can get all fields by not adding any parameters (products?per_page=100&page=1)
*/
add_filter( 'woocommerce_rest_prepare_product_object', 'my_woocommerce_rest_prepare_product_object', 10, 3 );
function my_woocommerce_rest_prepare_product_object( $response, $object, $request )
{
$data = $response->get_data();
$newdata = [];
if ($request['fields'] != null)
{
foreach ( explode ( ",", $request['fields'] ) as $field )
{
$newdata[$field] = $data[$field];
}
$response->set_data( $newdata );
}
return $response;
}
Source / Reference :
You might also like to read these articles below :
If you want to know the Order status flow in WooCommerce, you can check this article WooCommerce Order Status Flow in DealPOS
If you don't know how to upload products from POS to WooCommerce, you can check this article : In POS (Upload Product to Marketplace)
or you can check our full article related to the marketplace here
If you are a retail business owner and sell products offline and online stores. you can use DealPOS to manage products, inventory, and orders on one platform. DealPOS made it easier for you to sell omnichannel. Try DealPOS for 14 days for free now :