• Resolved rehiga

    (@rehiga)


    Hello CusRev Support Team,

    I am using the CusRev plugin on my WooCommerce store and I would like to enhance customer engagement by adding a “Ask a Question” button to each product in the product loop. Specifically, I want to display this button on the following pages:

    • Shop pages
    • Category pages
    • Tag pages
    • Cart page

    I understand that the shortcode [cusrev_qna products="" shop=""] can be used to display questions and answers for specific products or pages. I need guidance on how to dynamically insert this button for each product listed in the product loop on the above-mentioned pages. Here are the specific requirements:

    1. Shop, Category, Tag Pages: Display a “Ask a Question” button for each product in the loop.
    2. Cart Page: Include the button for each product listed in the cart.

    Could you please provide instructions or a code snippet that I can use to achieve this functionality?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter rehiga

    (@rehiga)

    I made some temporary changes. It is working, but it’s not the right way to do it.

    function exibir_ask_question_button_sobre_thumbnail() {
    global $product;
    if (!$product) {
    return;
    }

    $product_id = $product->get_id();
    echo '<div class="cr-qna-button-wrapper">' . do_shortcode('[cusrev_qna products="' . $product_id . '"]') . '</div>';
    }

    add_action('woocommerce_before_shop_loop_item_title', 'exibir_ask_question_button_sobre_thumbnail', 10);

    after the css:


    function adicionar_css_personalizado() {
    echo '<style>
    .cr-qna-button-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    //z-index: 101;
    }
    .products.row.row-small.large-columns-3.medium-columns-3.small-columns-1.has-equal-box-heights .cr-qna-block h2,
    .products.row.row-small.large-columns-3.medium-columns-3.small-columns-1.has-equal-box-heights .cr-qna-block .cr-ajax-qna-search,
    .products.row.row-small.large-columns-3.medium-columns-3.small-columns-1.has-equal-box-heights .cr-qna-block .cr-qna-list-block {
    display: none !important;
    }
    .products.row.row-small.large-columns-3.medium-columns-3.small-columns-1.has-equal-box-heights .cr-qna-ask-button,
    .product-small .cr-qna-ask-button {
    background-color: #8aa2c0 !important;
    margin-top: -45px;
    margin-right: 80px;
    border: none;
    cursor: pointer;
    z-index: 101;
    font-size:10px;
    }

    .products.row.row-small.large-columns-3.medium-columns-3.small-columns-1.has-equal-box-heights .cr-qna-ask-button,
    .products.row.row-small.large-columns-3.medium-columns-3.small-columns-1.has-equal-box-heights .cr-qna-ask-button h2,
    .product-small .cr-qna-ask-button {

    background-color: #8aa2c0 !important;

    margin-top: -45px;
    margin-right: 80px;
    border: none;
    cursor: pointer;
    z-index: 101;
    font-size:10px;
    }

    </style>';
    }
    add_action('wp_head', 'adicionar_css_personalizado');

    works on products loop pages

Viewing 1 replies (of 1 total)
  • The topic ‘Help with Adding “Ask a Question” Button to Product Loop’ is closed to new replies.