I am trying to build a custom Elementor widget, In this widget, I query woocommerce product and add the default woocommerce add to cart hook, but it is not working on the ajax. Do I need to include any js here? Can anyone help me with it?

<?php woocommerce_template_loop_product_thumbnail(); ?>
<div class="info">
    <h2 class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    <div class="category">

        <?php echo wc_get_product_category_list( $loop->post->ID, ', ', '' ); ?>

    <div class="price-wrapper">
        <?php woocommerce_template_loop_price(); ?>

    <div class="cart-btn">
        <?php woocommerce_template_loop_add_to_cart(); ?>
    <div class="user">
        <?php echo get_avatar(get_the_author_meta( 'ID' ), 50); ?>
        <span class="name"><?php the_author(); ?></span>

Your Answer

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

Browse other questions tagged or ask your own question.