• Resolved welikepotato

    (@welikepotato)


    I would like to show specific products in the related products section. How do I customize the related products?

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

    (@ndre)

    You can modify the related products in the related products template file.

    There is a line with the shortcode to show related products:

    echo do_shortcode( '[show_products post_type="' . $post_type . '" product="' . $products . '"]' );

    You can replace the $products variable with your own product IDs, like this:

    echo do_shortcode( '[show_products post_type="' . $post_type . '" product="45,23,12"]' );

    Please see the templates docs for details: https://implecode.com/docs/ecommerce-product-catalog/product-page-template/ (look into the “Create template for product page part” section)

    Thread Starter welikepotato

    (@welikepotato)

    If I change the $product variable to IDs, every product shows the same related products.

    I just can’t figure out how to change the related products for a specific product. Basically I would like to configure the related products for every product on my own.

    Is there a way to do this?

    Plugin Author ndre

    (@ndre)

    Currently the only way to set it for specific product is to use PHP.

    e.g.:

    <?php
    $product_id = ic_get_product_id();
    $related_products = $products;
    if ($product_id == 34) {
    $related_products = '45,23,12';
    }
    echo do_shortcode( '[show_products post_type="' . $post_type . '" product="' . $related_products . '"]' );
    ?>

    You can also play with other shortcode parameters. Please see the product shortcode docs for details.

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

The topic ‘Customize related products’ is closed to new replies.