• Resolved maidot

    (@maidot)


    Hi,

    Basically we have an integration between Microsoft Navision to import products to WordPress with WooCommerce.

    If products are created via code, it seems that those products are not getting indexed automatically as if we go manually inside edit product page and hit “Update”.

    So how can we do that in order for Relevanssi index those products created by code?

    Thank you.

    Best regards,
    Pedro Lima

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Relevanssi indexing is triggered on wp_insert_post hook, and looks like your integration is not triggering that.

    You can either fire the wp_insert_post hook in your product creation process, or you can call the relevanssi_index_doc() function directly to have Relevanssi index the created product.

    Thread Starter maidot

    (@maidot)

    Hi Mikko,

    Wow, thanks for such a fast answer!

    So basically, this means we only need to add this in the end of each product import, right?

    relevanssi_index_doc( $post_id, true, relevanssi_get_custom_fields(), true );

    Plugin Author Mikko Saari

    (@msaari)

    Yes, that would be one way to approach this.

    Thread Starter maidot

    (@maidot)

    Great. Thank you so much and wish you the best! 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘How to index products when inserted by code?’ is closed to new replies.