Add To Cart only if logged in
-
Hi,
I’ve got an online catalog setup to only display pricing when logged in. The theme however does not show the Ajax Add To Cart button on archive pages. So if I add the script below to functions.php, the button shows.
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_add_to_cart' );
However, I need this script to only take effect when the user is logged in. Currently all users can see the button.
Have tried to get an if statement going but my PHP coding skills aren’t the best.Any help appreciated.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Add To Cart only if logged in’ is closed to new replies.