WooCommerce Remote Sync — Actions & Filters
All hook names use {remote_slug} and {plugin_id} as placeholders. These are set per integration (e.g. fina, alta, onec).
Product Sync
plugandpay_woocommerce_remote_sync_{remote_slug}_sync_product_to_do_list
Type: filter When: Before a synced product is updated — controls which fields will be written to WooCommerce.
| Param | Type | Description |
|---|---|---|
$array | array | ['to_do' => string[], 'diff' => array] — tasks to perform and the changed values |
$remote_product_id | string | Remote product ID |
$integration | object | The integration instance |
Built-in to_do values: stock, stock_in_warehouse, price, sale_price, sale_start, sale_end, remote_product_id, remote_product_code, remote_product_meta
// Add a custom task to the to_do list (pair with the custom_doing action below).
add_filter(
'plugandpay_woocommerce_remote_sync_{remote_slug}_sync_product_to_do_list',
function ( $array ) {
$array['to_do'][] = 'do_something_with_stock_in_warehouse';
return $array;
}
);
plugandpay_woocommerce_remote_sync_{remote_slug}_sync_product_custom_doing
Type: action When: Inside the product sync loop, when a to_do task is not a built-in one. Pair with the filter above to handle custom tasks.
| Param | Type | Description |
|---|---|---|
$do | string | The custom task name |
$remote_product_id | string | Remote product ID |
$wc_product | \WC_Product | WooCommerce product object |
$integration | object | The integration instance |
add_action(
'plugandpay_woocommerce_remote_sync_{remote_slug}_sync_product_custom_doing',
function ( $do, $remote_product_id, $wc_product, $integration ) {
if ( 'do_something_with_stock_in_warehouse' === $do ) {
$stock_in_warehouse = $integration->service->get_product_stock_in_warehouse( $remote_product_id );
$wc_product->update_meta_data( 'stock_in_warehouse', $stock_in_warehouse );
}
},
10,
4
);
plugandpay_woocommerce_remote_sync_{remote_slug}_sync_products_list_columns
Type: filter When: When rendering the product sync list table in the admin — controls which columns are shown.
| Param | Type | Description |
|---|---|---|
$columns | array | Associative array of column_key => label |
// Add a custom column to the product sync list table.
add_filter(
'plugandpay_woocommerce_remote_sync_{remote_slug}_sync_products_list_columns',
function ( $columns ) {
$columns['my_custom_column'] = __( 'My Column', 'my-plugin' );
return $columns;
}
);
plugandpay_woocommerce_remote_sync_{remote_slug}_sync_products_list_row_after
Type: action When: After every row in the product sync list table is rendered — use to add extra <td> cells for custom columns.
| Param | Type | Description |
|---|---|---|
$row | array | The current sync table row data |
add_action(
'plugandpay_woocommerce_remote_sync_{remote_slug}_sync_products_list_row_after',
function ( $row ) {
// $row contains: id, wc_product_id, wc_parent_id, remote_product_id,
// wc_synced_date, diff (JSON), code, name, deleted_status.
// Custom data must be fetched from WooCommerce or post meta.
$wc_product = wc_get_product( $row['wc_product_id'] );
$value = $wc_product ? $wc_product->get_meta( '_my_custom_meta' ) : '-';
echo '<td>' . esc_html( $value ?: '-' ) . '</td>';
}
);
Product Import
plugandpay_woocommerce_remote_sync_{remote_slug}_import_products_simple_remote_product
Type: filter When: Before a simple product is created or updated in WooCommerce — lets you modify the remote product data before import.
| Param | Type | Description |
|---|---|---|
$remote_product | Importable_Product_Data | The remote product data object |
// Override the product name before import.
// Note: properties are readonly — return a new DTO with the changed values.
add_filter(
'plugandpay_woocommerce_remote_sync_{remote_slug}_import_products_simple_remote_product',
function ( $remote_product ) {
return new \PlugandPay\Remote_Sync\DTOs\Importable_Product_Data(
id: $remote_product->id,
code: $remote_product->code,
name: strtoupper( $remote_product->name ),
meta: $remote_product->meta,
group_by_id: $remote_product->group_by_id,
attributes: $remote_product->attributes,
categories: $remote_product->categories,
);
}
);
plugandpay_woocommerce_remote_sync_{remote_slug}_import_products_simple_end
Type: action When: After a simple product has been saved to WooCommerce — use to write additional data (description, meta, etc.).
| Param | Type | Description |
|---|---|---|
$wc_product_id | int | WooCommerce product ID |
$remote_product | Importable_Product_Data | The remote product data object |
// Import product description from a remote field.
add_action(
'plugandpay_woocommerce_remote_sync_{remote_slug}_import_products_simple_end',
function ( $wc_product_id, $remote_product ) {
$wc_product = wc_get_product( $wc_product_id );
if ( ! $wc_product ) {
return;
}
// Remote product data is available on the $remote_product DTO:
// id, code, name, group_by_id, attributes, categories, meta (array).
// Meta keys are service-specific — check your integration's service class.
$wc_product->set_description( $remote_product->meta['comment'] ?? '' );
$wc_product->save();
},
10,
2
);
plugandpay_woocommerce_remote_sync_{remote_slug}_import_products_variable_group
Type: filter When: Before a variable product group is processed — lets you modify the full group of remote product variants before any WooCommerce products are created.
| Param | Type | Description |
|---|---|---|
$group | Importable_Product_Data[] | Array of remote product data objects forming the variable group |
// Override the variable product's name from a custom remote field.
// Note: add_fields is Fina-specific and stored in meta — keys depend on your integration.
add_filter(
'plugandpay_woocommerce_remote_sync_{remote_slug}_import_products_variable_group',
function ( $remote_products ) {
$remote_products[0] = new \PlugandPay\Remote_Sync\DTOs\Importable_Product_Data(
id: $remote_products[0]->id,
code: $remote_products[0]->code,
name: $remote_products[0]->meta['add_fields']['usr_column_509'] ?? $remote_products[0]->name,
meta: $remote_products[0]->meta,
group_by_id: $remote_products[0]->group_by_id,
attributes: $remote_products[0]->attributes,
categories: $remote_products[0]->categories,
);
return $remote_products;
}
);
plugandpay_woocommerce_remote_sync_{remote_slug}_import_products_variable_end
Type: action When: After a variable product and all its variations have been saved to WooCommerce.
| Param | Type | Description |
|---|---|---|
$wc_parent_product_id | int | WooCommerce parent product ID |
$group | Importable_Product_Data[] | The full remote product group that was imported |
// Import a shared description onto the parent variable product.
add_action(
'plugandpay_woocommerce_remote_sync_{remote_slug}_import_products_variable_end',
function ( $wc_parent_product_id, $group ) {
$wc_product = wc_get_product( $wc_parent_product_id );
if ( ! $wc_product ) {
return;
}
// Remote product data is available on the $remote_product DTO:
// id, code, name, group_by_id, attributes, categories, meta (array).
// Meta keys are service-specific — check your integration's service class.
$wc_product->set_description( $group[0]->meta['comment'] ?? '' );
$wc_product->save();
},
10,
2
);
Order Sync
plugandpay_woocommerce_remote_sync_{remote_slug}_sync_order_data
Type: filter When: Before an order payload is sent to the remote service — lets you modify the full order array.
| Param | Type | Description |
|---|---|---|
$service_order | array | The prepared order data to be sent |
$order_id | int | WooCommerce order ID |
$remote_order_id | string | Remote order ID (empty string if new) |
$order | \WC_Order | WooCommerce order object |
// Append a custom note to every outgoing order.
add_filter(
'plugandpay_woocommerce_remote_sync_{remote_slug}_sync_order_data',
function ( $service_order, $order_id, $remote_order_id, $order ) {
$service_order['comment'] = 'Source: WooCommerce #' . $order_id;
return $service_order;
},
10,
4
);
plugandpay_woocommerce_remote_sync_{remote_slug}_sync_order_customer_data
Type: filter When: Before a customer payload is sent to the remote service during order sync.
| Param | Type | Description |
|---|---|---|
$service_customer | array | The prepared customer data to be sent |
$customer_id | int | WooCommerce customer (user) ID |
$remote_customer_id | string|null | Remote customer ID if known |
$order | \WC_Order | WooCommerce order object |
// Add a custom field to the customer payload.
add_filter(
'plugandpay_woocommerce_remote_sync_{remote_slug}_sync_order_customer_data',
function ( $service_customer, $customer_id, $remote_customer_id, $order ) {
$service_customer['vip'] = (bool) get_user_meta( $customer_id, 'is_vip', true );
return $service_customer;
},
10,
4
);
plugandpay_woocommerce_remote_sync_{remote_slug}_sync_order_override_customer_id
Type: filter When: At the start of customer resolution during order sync — return a remote customer ID to force all orders to sync against a single fixed customer.
| Param | Type | Description |
|---|---|---|
$override_customer_id | false|string | Default false — return a string ID to override |
// Sync all orders to a single fixed customer in the remote service.
add_filter(
'plugandpay_woocommerce_remote_sync_{remote_slug}_sync_order_override_customer_id',
function ( $override_customer_id ) {
return 'FIXED_REMOTE_CUSTOMER_ID';
}
);
plugandpay_woocommerce_remote_sync_{remote_slug}_sync_order_retrieve_product_params
Type: filter When: For each line item during order sync — lets you modify the item array before it is sent to the remote service.
| Param | Type | Description |
|---|---|---|
$params | array | The prepared line item data |
$item | \WC_Order_Item_Product | WooCommerce order item |
$product | \WC_Product | WooCommerce product |
// Append a remote product code to each order line item.
add_filter(
'plugandpay_woocommerce_remote_sync_{remote_slug}_sync_order_retrieve_product_params',
function ( $params, $item, $product ) {
$params['remote_code'] = $product->get_meta( '_remote_product_code' );
return $params;
},
10,
3
);
Checkout Fields & Validation
plugandpay_{plugin_id}_sync_order_personal_no_checkout_field_params
Type: filter When: When building the Personal Number checkout field — lets you change any field parameter.
| Param | Type | Description |
|---|---|---|
$params | array | WooCommerce checkout field config array (type, label, required, maxlength, …) |
add_filter(
'plugandpay_{plugin_id}_sync_order_personal_no_checkout_field_params',
function ( $params ) {
$params['label'] = __( 'ID Number', 'my-plugin' );
$params['required'] = false;
return $params;
}
);
plugandpay_{plugin_id}_sync_order_validate_personal_no_char_length
Type: filter When: When rendering and validating the Personal Number field. Controls the accepted character length.
| Param | Type | Description |
|---|---|---|
$length | int | Default 11 |
add_filter(
'plugandpay_{plugin_id}_sync_order_validate_personal_no_char_length',
function () {
return 9;
}
);
plugandpay_{plugin_id}_sync_order_validate_personal_no_char_length_test
Type: filter When: Controls whether the character length check is enforced during checkout validation.
| Param | Type | Description |
|---|---|---|
$enabled | bool | Default true |
// Disable the length check (e.g. during testing).
add_filter(
'plugandpay_{plugin_id}_sync_order_validate_personal_no_char_length_test',
function () {
return false;
}
);
plugandpay_{plugin_id}_sync_order_validate_personal_no_numbers_only
Type: filter When: Controls whether the Personal Number field rejects non-numeric characters during checkout validation.
| Param | Type | Description |
|---|---|---|
$enabled | bool | Default true |
// Allow letters in the personal number field.
add_filter(
'plugandpay_{plugin_id}_sync_order_validate_personal_no_numbers_only',
function () {
return false;
}
);
API
plugandpay_{plugin_id}_api_request_args
Type: filter When: Before every outgoing API request — lets you modify the wp_remote_request() args (headers, timeout, body, etc.).
| Param | Type | Description |
|---|---|---|
$args | array | wp_remote_request() arguments |
$endpoint | string | The API endpoint being requested |
// Add a custom header to all API requests.
add_filter(
'plugandpay_{plugin_id}_api_request_args',
function ( $args, $endpoint ) {
$args['headers']['X-Custom-Header'] = 'my-value';
return $args;
},
10,
2
);