Join

Embed a WooCommerce Product and Checkout Redirect Into a Single Link

Don't want to mess with code snippets? Request for this to be a feature of MyListing Pro.

Instructions

  1. Create a new HTML code snippet.
  2. Copy the contents of code snippet below.
  3. Paste the contents into your code snippet.
  4. Review any notes that I’ve provided.
  5. Save and enable the code snippet.
  6. Test.

Snippet

When customers click on the link, the product is added to their cart, and they are automatically redirected to the Cart page.

  1. Adjust the domain name.
  2. Add the slug of your product.
  3. Add the product ID of your product.

Product IDs can be found by hovering over any of your products within the WordPress Dashboard.

Example

In this example, let’s work with a product named ‘Pro Membership’ that has a product ID of 579.

https://domain.com/product/pro-membership/?add-to-cart=579