mardi 28 juin 2016

Set cart permalink when cart is not empty

I have no cart link set in the backend of WooCommerce. Instead I have the cart redirected to the checkout page. This works fine, however now I end up with empty urls. When I add a product to the cart I get the message 'successfully added to the cart, see the cart here'. 'See the cart here' is linked to wc_get_page_permalink( 'cart' ), but this is not set.

Is it possible through a function to set the wc_get_page_permalink( 'cart' ) ONLY when items are in the cart?

I tried something like:

function custom_continue_shopping_redirect_url ( $product_id ) {
    $url = "http://www.url.com"; // Add your link here
    return $url;
}
add_filter('wc_add_to_cart_message', 'custom_continue_shopping_redirect_url');

But that is obviously replacing the whole add to cart message.

Thanks.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire