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

Okay
  Public Ticket #4566446
Does overriding product template affects the statistic of smart recommendation
Open

Comments

  • Truong started the conversation

    Dear,

    I just would like to understand the mechanism that Smart Recommendation track the click into the recommended products as I overrided the product template to fit with our expectation. And I would like to make sure that our overriding will not make the statistic wrong functioning.

  •  1,688
    Dustin replied

    Hi Truong,

    Here is the required HTML structure when overriding templates:

    #1. Wrapper container (rendered by PHP, not included in the template):

    <div class="wpcrc-products ...">

    #2. In the template, the following classes/attributes are required:

    <!-- ↓ REQUIRED: class + data-product-id -->
    <div class="wpcrc-product" data-product-id="<?php echo esc_attr($pid); ?>">
        <!-- ↓ REQUIRED: class wpcrc-product-link -->
        <a href="..." class="wpcrc-product-link">
            <!-- Image; name; etc. -->
        </a>
        <!-- ↓ REQUIRED: WC add-to-cart button (class add_to_cart_button) -->
        <div class="wpcrc-product-atc">
            <?php woocommerce_template_loop_add_to_cart(); ?>
        </div>
    </div>

    Best regards,
    Dustin