Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add custom parameters to WooCommerce products exported to Specter
/**
* Filter hook wc_specter_send_custom_product_data
* Add custom parameters to products sent to Specter.
* The product data will be passed to Specter both on single product update (save_post)
* and on manually triggered product exports (from the Specter settings page).
* Contact Specter for detailed information on what parameters their system accepts.
**/
add_filter( 'wc_specter_send_custom_product_data', 'my_custom_product_data', 10, 2 );
function my_custom_product_data( $args, $product ) {
$args['barCode'] = utf8_decode( get_post_meta( $product->id, 'my_custom_meta_field_1', true ) );
$args['buyPrice'] = utf8_decode( get_post_meta( $product->id, 'my_custom_meta_field_2', true ) );
return $args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.