Developer guide for customizing and extending PureClarity data feeds in WooCommerce with hooks, filters, and custom data
This guide is for developers who want to customize data feeds. Basic PHP and WordPress development knowledge is required. Always test customizations in a staging environment first.
The PureClarity WooCommerce plugin provides several hooks and filters that allow developers to customize the data that is sent to PureClarity. This enables advanced customizations for specific business requirements.
Feed modifications can affect recommendation quality. Test thoroughly and monitor results when implementing custom feed logic.
// Exclude specific products from feedsadd_filter('pureclarity_exclude_product', 'custom_product_exclusion', 10, 2);function custom_product_exclusion($exclude, $product_id) { $product = wc_get_product($product_id); // Exclude products with specific attributes if ($product->get_attribute('exclude_from_recommendations')) { return true; } // Exclude based on custom business logic if (custom_business_logic($product)) { return true; } return $exclude;}
/** * Add custom brand information to product feed * * @param array $product_data Existing product data * @param int $product_id WooCommerce product ID * @return array Modified product data with brand information */function add_brand_data($product_data, $product_id) { // Implementation here}