When creating product feeds for platforms like Google Shopping, Facebook, or TikTok, it’s often necessary to include custom product data, such as ACF fields, metadata, or native WordPress fields, beyond the default attributes.
Not only can you add these custom attributes to your feed, but you can also organize them into custom groups (like “Image attributes,” “Other fields,” or any label you prefer) to keep things neat and easy to manage in your feed plugin’s attribute dropdown.
The Solution: Add and Group Custom Attributes
Here’s a flexible code example showing how to:
- Add custom attributes grouped under your chosen label
- Populate those attributes with product data during feed generation
How to Customize
- Change $group_label to your desired group name, e.g., “Image attributes”, “SEO fields”, or “Custom metadata”.
- Add as many custom attributes as you want inside that group with unique keys and friendly labels.
- In the Field Mapping’s Value dropdown, your custom fields will appear under the group name you set, making mapping easier.
- Match the keys in $product_data inside the second function with the keys you used in the attribute list.
Use Cases for Grouping Attributes
Group Name | Example Attributes | Benefits |
---|---|---|
Image attributes | custom_image_url, hover_image, video_url | Easier to find and map image-related data |
Other fields | custom_product_flag, warehouse_location | Groups miscellaneous custom data |
SEO Fields | seo_title, seo_description | Groups’ miscellaneous custom data |
By grouping your custom product attributes under meaningful categories, you can keep your feed configuration clean and scalable, especially useful for stores with many custom fields.
This method works in both Product Feed PRO and ELITE plugins, allowing you to add custom fields from ACF, post meta, or core WordPress fields seamlessly.