Support » Plugin: Pixel Caffeine » A Category-Related Field Is Missing

Viewing 1 replies (of 1 total)
  • Plugin Author Antonino Scarfì

    (@antoscarface)

    Hi,

    it seems a new thing from Facebook, that is there are some fields required based on the google category you assigned that you must define inside the product feed (it’s not a requirement from Pixel Caffeine).

    There isn’t a easy solution at now, unfortunately, but you may add a hook in the code in order to specify manually the value for those fields. Here an example:

    
    add_filter('aepc_feed_item', function($fields, $item) {
    	$product_id = $item->get_id();
    	$product = wc_get_product($product_id);
    	
    	// EDIT HERE
    	$fields['g:color'] = $product->get_attribute('color');
    	$fields['g:gender'] = $product->get_attribute('gender');
    	$fields['g:age_group'] = $product->get_attribute('age_group');
    	$fields['g:size'] = $product->get_attribute('size');
    	// END EDIT HERE
    	
    	return $fields;
    }, 10, 2);
    
    

    It is just an example that must be adapted to your case and to your website data. I’m assuming that there are four attributes from WooCommerce, one per field, but you need to adjust it with the real attribute name.

    Anyway, you need to define a value in those fields in product feed, so if you don’t have any attribute for “color” or “gender” and so on, you need to create new ones as an attribute in WooCommerce or add a way to define them in the hook above.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.