Search
 
SCRIPT & CODE EXAMPLE
 

PHP

woocommerce custom add cart urls

URL: Add One Simple Product to Cart
href=”https://yourdomain.com/?add-to-cart=25″

URL: Add One Simple Product to Cart with Quantity = 3
href=”https://yourdomain.com/?add-to-cart=25&quantity=3″

URL: Add One Simple Product to Cart & Redirect to Cart Afterwards
href=”https://yourdomain.com/cart/?add-to-cart=25″

URL: Add One Simple Product to Cart & Redirect to Checkout Afterwards
href=”https://yourdomain.com/checkout/?add-to-cart=25″

URL: Add One Simple Product to Cart & Redirect to Any Page Afterwards
href=”https://yourdomain.com/your_custom_page/?add-to-cart=25″

URL: Add One Variable Product to Cart
href=”https://yourdomain.com/?add-to-cart=88″

URL: Add One Variable Product to Cart (with Quantity = 3)
href=”https://yourdomain.com/?add-to-cart=88&quantity=3″

URL: Add One Variable Product to Cart & Redirect to Cart
href=”https://yourdomain.com/cart/?add-to-cart=88″

URL: Add One Variable Product to Cart & Redirect to Checkout
href=”https://yourdomain.com/checkout/?add-to-cart=88″

URL: Add One Variable Product to Cart & Redirect to Any Page
href=”https://yourdomain.com/any-page-url/?add-to-cart=88″

URL: Add a Grouped Product to Cart
You will need the Grouped Product ID, which can be found in the usual way, and also the sub-product IDs. Then, use something like:

href=”https://yourdomain.com/?add-to-cart=3111&quantity[1803]=5&quantity[1903]=2″
Comment

How do I change the URL of Add to cart in WooCommerce

function _url_to_redirect() { 
    return 'http://www.aliexpress.com/'; 
}
add_filter( 'woocommerce_add_to_cart_redirect', '_url_to_redirect' );
Comment

PREVIOUS NEXT
Code Example
Php :: laravel store file 
Php :: laravel inline if else if 
Php :: wp change num words exerpct 
Php :: rewrite url to exclude php extension 
Php :: laravel localization 
Php :: Laravel jwt check token sent by request is valid 
Php :: how check the checkbox is check php 
Php :: php sort array by longest 
Php :: get admin url wordpress 
Php :: php function 
Php :: get id from current url for php 
Php :: laravel include config 
Php :: generate fake name php 
Php :: php get variable by string name 
Php :: array marge in php 
Php :: laravel filesystem link 
Php :: wordpress limit post content length 
Php :: routes not defined 
Php :: add key value array php 
Php :: php flip array 
Php :: laravel import data from csv 
Php :: PHP OOP - Static properties 
Php :: php docs comments 
Php :: $ is not define in laravel 
Php :: PHP strrpos — Find the position of the last occurrence of a substring in a string 
Php :: static class methods php 
Php :: disable sidebar widget wordpress 5.8 
Php :: laravel pagination limit page 
Php :: sum two numbers in php 
Php :: laravel CORS config `allowed_origins` should be an array 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =