• Resolved smams

    (@smams)


    Is it possible to have this configure button appear on each product listing in the archive page instead of the single product page?

    Many thanks,

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Marc Lacroix

    (@marcusig)

    Hi there,

    It is technically possible, though at the moment, depending on how many configurable products will be shown on an archive page, it could make it a bit heavy and impact performance, because of the data for each product would be loaded on the archive.

    The idea is to use the shortcode [mkl_configurator_button] in the loop. Something like that:

    <?php 
    add_actino( 'woocommerce_after_shop_loop_item', function() {
    	global $product;
    	if ( ! function_exists( 'mkl_pc_is_configurable' ) ) return;
    	if ( mkl_pc_is_configurable( $product->get_id() ) ) {
    		echo do_shortcode( '[mkl_configurator_button product_id="' . $product->get_id() . '"]"' );
    	}
    }, 11 );
    
    add_filter( 'load_configurator_on_page', '__return_true' );
    
    Thread Starter smams

    (@smams)

    That’s great, thank you for your help.

    Marc Lacroix
    I was tried you’re provided code. But it displaying the configurator with the first product on the archive page. And it not working with all other products, on archive page. it’s showing the this message for all other products ‘The provided ID is not a valid product.’
    Can you please assist me with this issue? I would greatly appreciate your help.

    Plugin Contributor Marc Lacroix

    (@marcusig)

    Hi @arham786,

    Please open your own issue to prevent other participants from receiving all the answers.

    Marc

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Adding configure button on archive page’ is closed to new replies.