New Landing How can we help? Themeforest Theme Support Joyn Direct to cart from shop page 'add to cart' buttons?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Posted in: Joyn
  • #162242
    mhote
    Member
    Post count: 394

    Hi, on our single product pages, when a user clicks ‘add to cart’, they are skipped to the checkout page via this code

    // SKIP CART - DIRECT TO CHECKOUT
    add_filter ('add_to_cart_redirect', 'woo_redirect_to_checkout');
    
    function woo_redirect_to_checkout() {
      global $woocommerce;
        $checkout_url = $woocommerce->cart->get_checkout_url();
        return $checkout_url;
    }

    But for the theme we can’t figure out how to do this from the shop ‘add to cart’ button?

    #162256
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Hi,

    In Woocommerce settings you have an option(Products-> Display Tab) to redirect to the cart page after adding to cart, since you have that filter it’s suppose to redirect you to the checkout page after adding to the cart.

    Just a question, why redirecting to the checkout when it’s possible that the customers buy more products if they still “surfing” in the shop?

    -Rui

    #162284
    mhote
    Member
    Post count: 394
    This reply has been marked as private.
    #162356
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Ok I understand, it makes sense. Thanks for explaining
    Can you provide the site url and admin credentials to see your Woocommerce settings?

    thanks

    -Rui

    #162407
    mhote
    Member
    Post count: 394
    This reply has been marked as private.
    #162550
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please paste this code at functions.php of child theme.

    add_filter( 'woocommerce_add_to_cart_redirect', 'wc_custom_cart_redirect' );
    function wc_custom_cart_redirect() {
      global $woocommerce;
        $checkout_url = $woocommerce->cart->get_checkout_url();
        return $checkout_url;
    }

    Thanks
    Mohammad

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register