Add custom parameters to WooCommerce products exported to Specter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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