You can create “add to cart” links for WooCommerce using this pattern on simple links:
http://example.com/cart/?add-to-cart=<product ID>&quantity=<number of quantity>
This example will work with simple products.
If you want to use products with variations you need to add some more values to the URL like:
http://example.com/cart/?add-to-cart=123&variation_id=456&attribute_pa_colour=black
If you enter the slug of the cart page in this url, here: /cart/
, it should redirect to the cart.
To add a product to the cart without redirecting:
http://example.com/?add-to-cart=<product ID>
Related Posts:
- Order by rating not works in wp_query
- Woocommerce checkout fields on the same line
- display available size on hover, in woocommerce shop page [closed]
- How to Add Product Variation with Multiple Images via WooCommerce REST API
- WooCommerce: Email Notifications
- How do you add custom metadata to WooCommerce orders? Specifically a second external order ID
- WooCommerce: Adding Order Item Meta Data That’s Hidden
- Hide tabs on woocommerce product editor for user role
- Woocommerce add_to_cart non-register visitor not working
- Redirect user after login through woocommerce login page to page with his/her username?
- WooCommerce restore stock on order cancel
- WooCommerce: The model of e-mail is displaying only the html, not css [closed]
- How to show loading spinner after click on add to cart button [closed]
- Authenticate user into wordpress via 3rd party system, both with the same domain
- WordPress select field – show current value?
- Arranging Product Details on Shop Page
- How to get woocommerce subscription next payment date or date when subscription expires in woocommerce_subscription_renewal_payment_complete hook?
- WooCommerce product taxonomies and menu export
- Javascript / Ajax Error After Migrating To New Domain Name
- How can i stop woocommerce checkout event based on api request result?
- WordPress Twenty Seventeen header image size not responsive for mobile
- Display Message if woocommerce coupon is not applicable to some items in the cart
- (Woocommerce) How to add a custom page between cart and checkout with a file upload field per product item in the cart?
- Force uppercase on some WooCommerce checkout fields input
- Display custom field without plugin in woocommerce
- How to output php between header and woocommerce container
- WooCommerce – How can I make single product gallery show two images on the slider at once?
- How to delete all customer user account that haven’t placed a single order?
- How do I hide ‘out of stock’ products in the admin ‘product’ page?
- Hide the prefix before the price of the product [closed]
- Backend users list – add Woocommerce meta to table
- Delete cookie when changing url (when navigating away from specific page of website)
- woocommerce axios react
- Woocommerce hook on address field change [closed]
- Maintenance mode just for WooCommerce shop pages [closed]
- Custom email template for a specific product category
- update_post_meta not work [closed]
- Same request Mysql/Php not same result
- WooCommerce Registration redirect based on page ID
- Get woocommerce coupon code
- Woocommerce change price in cart when discounted
- Woocommerce Remove Tax by Product Type
- WooCommerce print subcategory of product
- Woocommerce – sell a certain category by unit, another by weight? How?
- Woocommerce Product permalinks “product” word is not working
- Add custom parameters to Woocommerce add to cart link
- How to automatically change the status of product from draft to published when stock qty change from 0 > 1
- Issue with WordPress customize
- Woocommerce checkout page issue – Payment methods not loading – strange “Credit/Debit Card Secure Payment” form
- Sort products by Sale price and stock status
- Pagination in woocommerce – Limiting page-numbers
- Syncing WP Database Changes Between Environments: How To Handle Merging w/o touching database
- Delete method giving 500 error, for this endpoint /wc/store/cart/items
- In woocommerce product details not showing
- Re-arrange the Woocommerce checkout page layout
- How to sort products by price ASC and place all no price products to the end? (Woocommerce)
- Change order of combined product tabs
- Display notice on WooCommerce emails depending on chosen shipping option
- Impossible to create a new WooCommerce customer using Rest API
- edit URL of search result
- WooCommerce Stripe Test mode
- Parameters in woocommerce_before_add_to_cart_button hook
- Check if product variation image is from the variation itself or from the parent
- WordPress Woocommerce Endpoint URL
- Will ‘private’ status prevent Woocommerce products to be indexed by search engines?
- How to use products shortcode in taxonomy-product_cat with multiple columns?
- Position WooCommerce basket and pricing
- Display Products Associated with Specific Attribute [closed]
- Add to cart is not visible in product page
- Notice: Trying to get property of non-object in
- French accented text replaced with ? in woocommerce product list
- Trying to figure out why an error is returned when trying to add an item to the basket on this website
- Conditionnaly replace “Read more” text WooCommerce products
- WooCommerce/Authorize.net interface problem
- Using category and its sub-categories products attributes as filter in products pages
- How to make a custom redirect in WooCommerce?
- Firstname and lastname greyout or hidden Billing details at next checkout like username is hidden [closed]
- How to use woo commerce login to authenticate code php pages?
- Change order status after checkout
- Is it safe to update an old site after backing it up and activating a child theme?
- how to add custom reviews button in woocommerce order complete generated mail
- Click Count on Download a File
- How to add coupon expiry date into the followup emails?
- Disable Woocommerce main shop page, but not the product category archive pages
- Not all strings are translated
- Custom Woocommerce checkout filed yields a Json error when validating [closed]
- access Woo commerce | WordPress methods externally
- How to store ACF from product in user_meta?
- How to display Woocommerce catagories
- Woocommerce set single city to sell to
- Trying to link to a custom css file in a new folder
- eCommerce solution doesn’t want to display its shortcodes or any content where it’s set to [closed]
- Woocommerce hidden fields with meta keys and values. how?
- How do I make a diagonal strikethrough on wordpress? [closed]
- Woocommerce – Remove ‘Buy Product’ Button from shop page [closed]
- Add woocommerce.css in template?
- error 500 in Back Office when using a woocommerce function in functions.php
- Sort by price when price is set in multiple keys
- Add a custom code with custom link after add to cart for every product
- WooCommerce product permalink based on product’s current category