thup90 on "[Plugin: WooCommerce] Ajax Add to cart button for front page"

ساخت وبلاگ

Hello,

On my front page, there are the latest products from a category being shown. I have added Woocommerce Ajax add to cart plugin (by Oraksoft) so it's working on my single product page. However, I want to ajaxify the products shown on front page as well. I'm wondering if there is a way to do this? My products are simple products.

https://wordpress.org/plugins/woocommerce/

It depends on how your front page is adding the products to it. Is it coming from a shortcode, or it the page automatically generated?

Do you have the "ajax add to cart" setting enabled at WooCommerce > Settings > Products > Display?

@Caleb Burks The products are being displayed using the Product Category in Visual Composer, but I could also code a loop if it helps accomplishing the ajax effect.

Yes, I do have the setting enabled. Ajax works fine on the Archive page, but not on the front page. My guess is the buttons don't have the same classes so ajax scripts can't find the data from the button on the front page, but I'm not sure how to apply it to content-product.php , using maybe this gist https://gist.github.com/webaware/6260468 ?

Hmm, ajax add to cart is working for me on a custom page with the recent products shortcode: http://cld.wthms.co/A3Tp/3FFVMnEk

Have you tried using one of the WooCommerce shortcodes? I'd think that is what visual composer does though...strange.

thup90
Member
Posted 11 minutes ago #

I have tried switching to the recent products shortcode, but it also doesn't work.

I think I know why now, it's definitely because of the ajax function in Woocommerce settings, when I enable the setting alone, nothing happens even on archive pages. So I have been using the Gist https://gist.github.com/webaware/6260468 to make ajax on the archive page work. The setting doesn't work on archive page, so I guess it makes sense that it doesn't work on a custom page. Do you have a clue as to why the built-in ajax doesn't work?

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 503 تاريخ : پنجشنبه 4 شهريور 1395 ساعت: 14:08