• Resolved masini2002

    (@masini2002)


    Hi! Congratulations on the plugin.

    I have products with variations. Each variation has its own SKU.

    When searching by SKU the variations appear and clicking on the variations found takes me to the variation page.

    But I wish I could change that behavior. Would it be possible that clicking on the variations found instead of going to the variation would go directly to the main product (where all the variations of the product would be).

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author wpdreams

    (@wpdreams)

    Hi,

    It should be doable, try this custom code:

    add_filter('asl_results', 'my_custom_asl_results', 9999999, 1);
    function my_custom_asl_results($results) {
    	foreach ( $results as $k => &$r ) {
    		if ( $r->post_type == 'product_variation' ) {
    			$r->link = get_permalink(wp_get_post_parent_id($r->id));
    		}
    	}
    	return $results;
    }

    Best,
    Ernest M.

    Thread Starter masini2002

    (@masini2002)

    It works perfectly. Thank you very much for the help.

    Plugin Author wpdreams

    (@wpdreams)

    Great ?? I will mark this as resolved then.

    Feel free to rate the plugin if you like it, it is greatly appreciated.

    Best,
    Ernest M.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change result url (products with variations)’ is closed to new replies.