Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NiklasHogefjord/f510e402a28b85bd6bd0bc27400d67a3 to your computer and use it in GitHub Desktop.
Save NiklasHogefjord/f510e402a28b85bd6bd0bc27400d67a3 to your computer and use it in GitHub Desktop.
Remove articleType as parameter sent to Specter on product updates. This can be useful if some articles are marked as "paketartiklar" in Specter (since WooCommerce don't have support for that).
<?php
add_filter( 'wc_specter_send_custom_product_data', 'my_custom_product_data', 10, 3 );
function my_custom_product_data( $params, $product, $is_variation = false ) {
/**
* $params is the product data stored as an array.
* $product is the product object. Product variation object if this is a product variation.
* $is_variation is true/false depending on if this is a product variation or not.
*/
// Unset articleType type so we don't send that to Specter when product is updated in WooCommerce.
if( array_key_exists( 'articleType', $params ) ) {
unset($params['articleType']);
}
return $params;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment