• Resolved grantmahy

    (@grantmahy)


    I am wondering if anyone has done a snippet of php code that can be added to the functions php of a child theme to have an empty cart direct to a product page rather than the shop page (it defaults to now) if someone clicks it (when empty). For now I am only going to have the cart show when items are in it but this is a bit of a shame. Thanks guys, it’s a nice little plugin although perhaps it would be good to have an option which page an empty cart should direct to *re url* if clicked on.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter grantmahy

    (@grantmahy)

    All good this works when added to the functions php – Luckily someone had already encountered the same problem and put the solution online. This code works a treat

    /**

    • Set page url when cart is empty
      */
      add_filter(‘wpmenucart_emptyurl’, ‘add_wpmenucart_emptyurl’, 1, 1);
      function add_wpmenucart_emptyurl ($empty_url) {
      $empty_url = ‘ENTER URL YOU WISH TO DIRECT TO HERE’;
      return $empty_url;
      }
    • This reply was modified 11 months, 2 weeks ago by grantmahy.
    Plugin Contributor Yordan Soares

    (@yordansoares)

    I’m glad to hear that you found out a solution for your need, @grantmahy!

    Let us know if you need anything else ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Any way of having empty cart redirect to another page not shop page’ is closed to new replies.