PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Ajaxify my theme

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

Hello, I created my own wordpress theme and the Ajaxify is not working (the selected filters do, but the products are not being updated).

Is there something I should add (like class names, actions, etc.) to my theme in order to make it Husky-ready?

Hello

Please  add  hooks - woocommerce_before_shop_loop  and  woocommerce_after_shop_loop

<?php if ( woocommerce_product_loop() ) { ?>
<div id="main-content">
<?php
do_action( 'woocommerce_before_shop_loop' );
woocommerce_product_loop_start();

if ( wc_get_loop_prop( 'total' ) ) {
while ( have_posts() ) {
the_post();
do_action( 'woocommerce_shop_loop' ); ?>
<div class="wc-product x-3 m-4 s-6 z-12" itemscope itemtype="http://schema.org/Product">
<?php wc_get_template_part( 'content', 'product' ); ?>
</div>
<?php }
}

woocommerce_product_loop_end();
do_action( 'woocommerce_after_shop_loop' ); ?>
</div>
<?php
} else {
do_action( 'woocommerce_no_products_found' );
} ?>


The above is inside the archive-product.php
As you can see the hooks you mentioned already exist.
The file archive-product.php is inside my theme/woocommerce folder to override the original one. But even if I remove this file and use the original WooCommerce, the Ajax still doesn't work.

Is there something else that Husky needs to work with Ajax?

Please drop me exact  link to the issue

I already did in the private section. You cannot see it?

If you visit the link you will see that if you click an option, the products are not being updated via Ajax.

Hello

I checked everything is working correctly.

Perhaps you made a mistake with this setting - https://share.pluginus.net/image/i20231114123618.png - Please  disable  it

OK that worked!

Is there a way for me to add some html? This is what I mean:

This is the original code of woocommerce (archive-product.php)

if ( wc_get_loop_prop( 'total' ) ) {
  while ( have_posts() ) {
    the_post();
    do_action( 'woocommerce_shop_loop' );
    wc_get_template_part( 'content', 'product' );
  }
}

I added one div element to wrap each product:

if ( wc_get_loop_prop( 'total' ) ) {
  while ( have_posts() ) {
    the_post();
    do_action( 'woocommerce_shop_loop' ); ?>
    <div class="wc-product x-3 m-4 s-6 z-12" itemscope itemtype="http://schema.org/Product">
      <?php wc_get_template_part( 'content', 'product' ); ?>
    </div>
  <?php }
}

When the category page loads originally, this div element exists. But when I click on a filter this div element is being removed.

For example I use this code to change the columns from 4 to 3:

if (defined('WOOF_PATH')){
  add_filter('loop_shop_columns',function(){ return 3; });
}

Is there a similar hook I can use in order to add this HTML div while keeping the AJAX functionality of the filtering?

Nevermind, I found it.

I simply added the div element inside content-product.php instead of archive-product.php because of this: `wc_get_template_part( 'content', 'product' );`

Thanks for your help!

Hello

great! Welcome;)