woocommerce / pinterest-for-woocommerce

A native Pinterest integration for WooCommerce. Development is managed by Ventures.
https://woocommerce.com/products/pinterest-for-woocommerce/
GNU General Public License v3.0
22 stars 9 forks source link

Feed xml: Send additional item attributes #243

Open niketpins opened 2 years ago

niketpins commented 2 years ago

Feed xml only includes few attributes not all.

Following is the feed xml specs to add other item attributes

<?xml version="1.0"?>
<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">
    <channel>
        <item>
            <g:id>26</g:id>
            <item_group_id>12</item_group_id>
            <title><![CDATA[V-Neck T-Shirt - Red]]></title>
            <description><![CDATA[Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.]]></description>
            <g:product_type>Clothing > Tshirts</g:product_type>
            <link><![CDATA[https://dangerous-flamingo.jurassic.ninja/product/v-neck-t-shirt/?attribute_pa_color=red]]></link>
            <g:image_link><![CDATA[https://dangerous-flamingo.jurassic.ninja/wp-content/uploads/2021/10/vneck-tee-2-600x599.jpg]]></g:image_link>
            <g:availability>in stock</g:availability>
            <g:price>20USD</g:price>
            <g:mpn>woo-vneck-tee-red</g:mpn>
        <!-- added by Dragos -->
        <!-- first image from images should be in image_link, the rest of them as additional_image_link -->
            <g:additional_image_link>
<![CDATA[ https://dangerous-flamingo.jurassic.ninja/wp-content/uploads/2021/10/hoodie-blue-1-150x150.jpg,https://dangerous-flamingo.jurassic.ninja/wp-content/uploads/2021/10/hoodie-green-1-150x150.jpg,https://dangerous-flamingo.jurassic.ninja/wp-content/uploads/2021/10/hoodie-with-logo-2-150x150.jpg ]]>
            </g:additional_image_link>
        <!-- sale_price should be added --> 
            <g:sale_price>18USD</g:sale_price>
        <!-- date_sale_price_starts/date_sale_price_ends should be added as sale_price_effective_date-->    
            <g:sale_price_effective_date>2021-10-01T16:00-08:00/2021-10-03T16:00-08:00</g:sale_price_effective_date>
        <!-- if one of the variant attribute (defined in attribute_1_name or attribute_2_name) is color, then the value should be populated -->
            <g:color>red</g:color>
        <!-- if one of the variant attribute (defined in attribute_1_name or attribute_2_name) is size, then the value should be populated -->
            <g:size>small</g:size>
        <!-- attribute_1_name/attribute_2_name should be added as comma separated variant_names-->
            <g:variant_names>color, logo</g:variant_names>
        <!-- attribute_1_value/attribute_2_value should be added as comma separated variant_values-->
            <g:variant_values>red, yes</g:variant_values>
        <!-- inverse of sold_individually should be added as is_bundle (if the format matches true/false) -->
            <g:is_bundle>true</g:is_bundle>
        <!-- shipping_class should be added as shipping (if the format matches country:region:service:price(required)) -->
            <g:shipping>US:CA:Ground:0 USD</g:shipping>
        <!-- tax_class should be added as tax (if the format matches country:region:rate(required):tax_ship) -->
            <g:tax>US:1025433:6.00:y</g:tax>
        <!-- weight/length/width/height should be added as shipping_weight/shipping_length/shipping_width/shipping_height -->
            <g:shipping_weight>0.5 lbs</g:shipping_weight>
            <g:shipping_length>23 in</g:shipping_length>
            <g:shipping_width>5 in</g:shipping_width>
            <g:shipping_height>1 in</g:shipping_height>
        <!-- first 5 tags could/should be split into 5 custom labels and added for better PG management -->
            <g:custom_label_0>tag1</g:custom_label_0>
            <g:custom_label_1>tag2</g:custom_label_1>
            <g:custom_label_2>tag3</g:custom_label_2>
            <g:custom_label_3>tag4</g:custom_label_3>
            <g:custom_label_4>tag5</g:custom_label_4>
        <!-- end added by Dragos -->
        </item>
    </channel>
</rss>
jconroy commented 2 years ago

@niketpins I think the extension does already handle a few of these

https://github.com/woocommerce/pinterest-for-woocommerce/blob/eb98cfed04cf5d2bba72c98f500e59ee0ae46899/src/ProductsXmlFeed.php#L35-L39

I haven't dived in deep but I suspect its only adding them if they are available.

ksere commented 2 years ago

Hey @jconroy,

Some of the extra attributes requested here are frequently found in WC product attributes, for example color, size but since these are not standardized in any way, I am thinking we need a way to configure mappings between product attributes <=> Pinterest item attributes.

So this would require changes to the UI - possibly adding these to a new tab to the settings page (right now we got 3 tabs: Catalog / Settings / Connection ). Also other Pinterest item attributes like g:is_bundle could be taken from a custom field or even check if Product bundles is active and use the data from there.

Additionally g:custom_label_X can be implemented in a number of ways, like using existing product tags, or a custom field instead.

Any thoughts? Since this will require a number of UI changes, do you think its best to go through a design in Figma first?