Tagged: add to cart, category page, notifications
Hi Kriesi,
When I click an add to cart button on a product page the product is added to the cart and a notification is displayed at the top of the page.
When I click an add to cart button on a product category page the product is added to the cart but no notification is displayed. I added the notification function wc_print_notices(); in the product category page template (archive-product.php) but the add to cart button triggers an ajax call so the notification wil never show.
Is it possible to show notifications when the add to cart button is clicked on a product category page?
Regards,
Rob van Heijst
Hey Rob,
Could you please give us a link to your website, we need more context to be able to help you.
Best regards,
Victoria
Hi Victoria,
No problem. The link to the product page, the category page and the password are in the private content.
When you click the Add to Wishlist button on de product page you wil see a WordPress add to cart message (looks like a popup)
When you click the Add to Wishlist button on the category page you will only see a ✓ on the product.
We would also like the message popup to appear on the category page. wc_print_notices(); was added to the template.
Regards,
Rob van Heijst
Hi,
Thank you for the update.
Try to add this hook inside the category or archive template.
do_action( 'woocommerce_before_single_product' );
This is where the wc_print_notices function or the wrapper woocommerce_output_all_notices is hooked.
Best regards,
Ismael