0

I have a custom loop on my website home page of best selling products.

I am using wc_get_template_part('content', 'product'); to pull in the products.

But when I click the buy button, the buy button does not get the tick added to it, so it doesn't look the purchase has worked for users. The item is added to the cart. The buttons work as they should on other pages.

I have checked that "Enable AJAX add to basket buttons on archives" is ticked.

I have tried adding global to my code to see if that makes a difference.

There are no JS errors being logged.

Any ideas why it's not working as expected?

Here is my code:

<?php
    global $woocommerce_loop;
    global $product;
    $args = array(
    'post_type' => 'product',
    'meta_key' => 'total_sales',
    'orderby' => 'meta_value_num',
    'posts_per_page' => 12
    );
    $product = new WP_Query( $args );

    if ($product->have_posts()) {
    while ($product->have_posts()) {
        $product->the_post();
        wc_get_template_part('content', 'product');
    }
    ?>
0
0

The answer was that I had dequeued the woocommerce style sheets and fonts, adding the CSS back in made the tick marks appear

.added:after {
    font-family: WooCommerce;
    content: '\e017';
    margin-left: .53em;
    vertical-align: bottom;
    display: inline-block;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.