Please submit a private ticket if you need to share sensitive information, such as license details and admin credentials.

Okay
  Public Ticket #3069398
"Separator text" between products
Closed

Comments

  • Mateusz started the conversation

    Hello

    I want to know is there an aption to add text between "bought together" products? Like "above text" but this text will be between each list product.

  •  767
    Janilyn replied

    Hi Mateusz,

    Thank you for contacting WPClever Support Forum. 

    We’ve received your ticket and assigned one of our developers to help you with that. 

    He’ll be looking into your question and responding with specific instructions as soon as possible. 

    Please stay patient as we're having very heavy workloads, it might take some time for our developers to reach back.

    Best regards.

    Janilyn T. - WPClever Support Agent

  •  153
    Henry replied

    Hi Mateusz.

    May I ask what you would like to achieve with inserting text between Bought Together products like that? I need to know more in order to provide proper codes.

    Could you please provide an image to better illustrate your request?

    Thank you.

    Best regards,
    Henry N.

  • Mateusz replied

    We have one main product and we have lots of accessories for this product. We want to separate this accessories to various categories. Quick "sketch" in attachment.

  •  1,226
    Dustin replied

    Hi Mateusz,

    Currently, we can't add an option to add above/under text for each product in the frequently bought together products list https://www.screencast.com/t/HiCHDCGtYFP. It will complicate the product settings.

    I can help you do that with a snippet instead. Please follow the below steps:

    1. Find products that you want to place above text (Category A, Category B in your case). Example: product "Beanie with Logo" with ID 2644 and product "Cap" with ID "2629" https://www.screencast.com/t/xE3xnrrq3ZJ

    2. Add the below custom code (How to add custom code?)

    add_filter( 'woobt_product_output', 'woobt_product_above_text', 99, 3 );
    function woobt_product_above_text( $output, $item, $product_id ) {
        if ( $item['id'] === 2644 ) {
            return '<h3>Category A</h3>' . $output;
        }
        if ( $item['id'] === 2629 ) {
            return '<h3>Category B</h3>' . $output;
        }
        return $output;
    }

    And the result https://www.screencast.com/t/d2srLo9xJc

    Let me know if you need further help when using this snippet.

    Best regards,
    Dustin