• Resolved dreadedhamish

    (@dreadedhamish)


    I’ve moving some functions from functions.php to WPCode Snippets and this one stops working – any hints?
    Using everywhere placement.

    // Skip cart - straight to checkout
    add_filter('add_to_cart_redirect', obs_skip_cart_page');
    function obs_skip_cart_page () {
    global $woocommerce;
    $redirect_checkout = $woocommerce->cart->get_checkout_url();
    return $redirect_checkout;
    }

    Also is there a troubleshooting gudie somewhere that would help me troubleshoot it myself? – like with steps for “if it works in functions.php but not as a snippet then it could be one of these issues”

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mircea Sandu

    (@gripgrip)

    Hi @dreadedhamish,

    If the code is exactly as the one you pasted here, it looks like you are missing a ‘ (opening quote) before the “obs_skip_cart_page” function in the second row. It should be:

    add_filter('add_to_cart_redirect', 'obs_skip_cart_page');

    If that’s just missing in the code here we can look further into why this might not work.

    Thread Starter dreadedhamish

    (@dreadedhamish)

    @gripgrip argh…. that was it. It turns out I when i copied it to to a snippet I decided to change the function name, and I fat-fingered it. And then I totally forget I did that, and was convinced I just did a simple cut-and-paste and so the error must be elsewhere.

    Thanks for your time!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WooCommerce skip cart doesn’t work as a snippet’ is closed to new replies.