Support » Plugin: Pinterest for WooCommerce » Missing “condition” for root product with variants

  • Resolved ataub2qf

    (@ataub2qf)


    My client has variable products with multiple variants, eg https://shop.feenstaub.at/produkt/anlaesse/geburtstag/erster-geburtstag/taufe-gaestebuch-blanko-tiere/

    For the root product you can’t set up the condition, but only for the variants, see screenshot.

    The root product is also included in the feed, see ID 48753 in the current feed.

    Here the excerpt from the feed:

    <item>
    <g:id>48753</g:id>
    <title>
    <![CDATA[ Taufe Gästebuch - blanko 'Tierfamilie' ]]>
    </title>
    <description>
    <![CDATA[ Personalisierbares Gästebuch zur Taufe, Babyshower oder 1. Geburstag Sammelt die wertvollen Erinnerungen eures Babys in einem Gästebuch In drei Blattstärken, in Rosa oder Blau, mit Buchecken oder ohne, mit Babynamen und Datum personalisierbar. Das blanko Gästebuch eignet sich perfekt, um euren Gästen Platz für kreative Gedanken zu lassen oder um Fotos und ausgefüllte Gästebuch Karten einzukleben, die du natürlich auch in unserem Shop findest. Möchtest du lieber das Gästebuch mit vorgedruckten Fragen so findest du es hier in rosa oder blau. Möchtest du lieber einen hochwertigen Leinenbuchdeckel mit Gold- oder Silberprägung findest du das hier. Produktdetails: Format: 25x25cm - Wähle zwischen rosa Namen am Cover und blauen Namen am Cover - 30 Blatt (28 Doppeseiten für Gäste); 45 Blatt (43 Doppelseiten) oder 60 Blatt (58 Doppelseiten) - Inlays auf 170g Naturpapier blanko - Stabiler, hochwertiger, hardcover Buchdeckel, matt und kratzfest cellophaniert - Metall Spiralbindung in weiß - Buchecken aus Messing oder Nickel ]]>
    </description>
    <g:product_type>Gästebuch & -karten > Baby-Geburtstag > Gästebücher</g:product_type>
    <link>
    <![CDATA[ https://shop.feenstaub.at/produkt/anlaesse/geburtstag/erster-geburtstag/taufe-gaestebuch-blanko-tiere/ ]]>
    </link>
    <g:image_link>
    <![CDATA[ https://shop.feenstaub.at/wp-content/uploads/2017/01/taufe-gaestebuch-personalisierbar-album-zum-ausfuellen-mit-fragen-feenstaub-tiere-0317-500x438.jpg ]]>
    </g:image_link>
    <g:availability>in stock</g:availability>
    <g:price>26.90EUR</g:price>
    <g:mpn>Taufe Gästebuch - blanko - Tierfamilie</g:mpn>
    <g:additional_image_link>
    <![CDATA[ https://shop.feenstaub.at/wp-content/uploads/2017/01/taufe-gaestebuch-personalisierbar-album-zum-ausfuellen-mit-fragen-feenstaub-tiere-0318-500x438.jpg,https://shop.feenstaub.at/wp-content/uploads/2017/01/taufe-gaestebuch-personalisierbar-album-zum-ausfuellen-mit-fragen-feenstaub-tiere-0319-500x438.jpg,https://shop.feenstaub.at/wp-content/uploads/2017/01/taufe-gaestebuch-personalisierbar-album-zum-ausfuellen-mit-fragen-feenstaub-tiere-0323-500x438.jpg,https://shop.feenstaub.at/wp-content/uploads/2017/01/taufe-gaestebuch-personalisierbar-album-zum-ausfuellen-mit-fragen-feenstaub-tiere-0324-500x438.jpg,https://shop.feenstaub.at/wp-content/uploads/2017/01/taufe-gaestebuch-personalisierbar-album-zum-ausfuellen-mit-fragen-feenstaub-tiere-0326-500x438.jpg,https://shop.feenstaub.at/wp-content/uploads/2019/04/feenstaub-taufe-gästebuch-namen-personalisierbar-wien-1116-500x437.jpg ]]>
    </g:additional_image_link>
    <g:google_product_category>Arts & Entertainment > Party & Celebration > Party Supplies</g:google_product_category>
    </item>

    Pinterest then throws a warning for those products (german screenshot, telling, that condition for that root product is missing).

    AFAIK there is no way to ever order such a root product. So should it just be excluded from the feed by the plugin? Or do I need to change anything?

    Thanks!

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter ataub2qf

    (@ataub2qf)

    So if product with the product_type “variable” can never be purchased (but only its children variants), then I think the code in ./src/ProductSync.php#582 needs to change from:

    array_splice( $product_ids, $i + 1, 0, $children );

    to

    array_splice( $product_ids, $i, 1, $children );

    to replace the root id (variable base product) with the children (variants).

    Plugin Support Christian

    (@christian1983)

    Hey @ataub2qf ,

    Hope you are doing well!

    On future releases the Parent product of variable products will not be present on the feed file. So is not going to happen this issue

    I will post here when the fix is released.

    I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

    Best,
    Christian

    Thread Starter ataub2qf

    (@ataub2qf)

    Thanks. To get it working in the meantime, I programmed the following snipped, if anyone needs that right now:

    <?php
    
    function taubenkorb_filter_root_variable_elements($xml, $product )
    {
    	// Remove variable root element from feed
    	if($product->is_type('variable')) {
    		return '';
    	}	
    
        // Return the normal xml item
        return $xml;
    }
    add_filter( 'pinterest_for_woocommerce_feed_item_xml', 'taubenkorb_filter_root_variable_elements', 10, 2);

    FYI – it only filters the output, after all the products have been queued and the code for that xml has been generated, but it was the only solution I found 😉

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Missing “condition” for root product with variants’ is closed to new replies.