You can use wordpress referrer function.
For example set referrer URL in session by clicking on add to cart button or any button to store previous URL. Once login or register success add Woocommerce success login redirect to that URL.
For more information read WordPress referrer URL read here;
https://codex.wordpress.org/Function_Reference/wp_get_referer
For Woocommerce login redirect read here;
https://stackoverflow.com/questions/29342186/woocommerce-after-login-redirect
Related Posts:
- Woocommerce Login Redirect not working [closed]
- Redirect user after login through woocommerce login page to page with his/her username?
- How to check if is in cart page? [closed]
- WooCommerce lost password reset flow not working with SendGrid (redirect loop)
- Custom Redirect after registration in WooCommerce
- Import products to WooCommerce by CSV page won’t open [closed]
- Woocommerce login not working on the first try
- Redirect customer to login page (with other signup plugin) if user not logged in when proceeding to checkout
- Woocommerce – Want to block a user agent from accessing specific product pages
- How to – proper WordPress 301 redirects?
- WooCommerce – Redirect to a product after login
- Woocommerce, prevent login after registration and redirect to custom URL
- Woocommerce Login Redirect to old domain
- Redirect no product url’s to static url
- WooCommerce Registration redirect based on page ID
- wordpress/woocommerce login url not redirecting correctly
- WooCommerce get_author_posts_url() – Author URL redirecting to shop base
- Anonymous users can not access website
- Is it ok to 301 redirect product-category pages to custom pages?
- WooCommerce and ACF: How to Redirect Upon Add to Cart – Partially Working Example
- wordpress site auto redirect to another site when I enable woocommerce
- How to use woo commerce login to authenticate code php pages?
- mydomain.com/wp-login redirects to wordpress.com/wp-login
- Woocommerce login to specific page or referrer
- WooCommerce shop, my account, cart every page redirect to home page [closed]
- How to change redirect code? [duplicate]
- Login page so wide [closed]
- Remove login fields from /customer-account page [closed]
- Account Status/Login on Main Menu with Avatar Pictures
- How to modify username before logging in?
- Can’t update WooCommerce payment method title
- Woocommerce – Shop can’t find products after domain name change
- Set Post Thumbnail to external URL
- Allow HTML in product attributes for WooCommerce
- Woocommerce on Subdirectory
- woocommerce_sessions – Table does not exist
- Change WooCommerce state and city checkout fields to dropdowns related to the chosen country
- Show products as posts on archive page
- “error_message”: “Sorry, you cannot list resources.” using WooCommerce API
- Custom theme woocommerce product detail page template not working
- Woocommerce new shop page
- How to apply a custom coupon to a WooCommerce Subscription recurring amount?
- Woocommerce: sorting variable product
- Add class to latest item Woocommerce
- Increase the download speed of a large number of variations in WooCommerce
- Use woocomerce shop filters on other pages
- How update price for variable product
- Remove filter parameter from Link URL
- WooCommerce product details page category display
- Woocommerce – Default product image by user role
- remove add to cart for free (0 $) product woocommerce
- Customer Email Address
- Product related to post by title
- WooCommerce product id as permalink
- WordPress/Woocommerce Classes and adding new properties
- currentURL is not defined
- How to send an automatic email to a custom field in Woocommerce order meta 2 weeks after a product is bought
- merge tabs in woocommerce
- How to echo woocomerce attributes values in dropdown box
- Customize categroy catalog page
- How do you programatically add a booking item to the cart?
- Create post when new woocommerce order is created [closed]
- Woocommerce cart table too wide [closed]
- Add new page in WooCommerce My Account page
- How to import products to Woo Commerce given that WP All Import keeps timing out
- Merge “description” and “additional informations” product tab
- Add to cart is not visible in product page
- Clickable product image with hover effect
- I need to refresh the checkout page if someone changes the zip code
- Adding a second button next to the shop button Woocommerc [closed]
- Notice: Trying to get property of non-object in
- Updating WooCommerce product field when product author updates profile field
- 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
- Need help with AJAX login to call php in functions.php to handle redirects based on user cap (role)
- Correct method of reducing the number of images created by WP and Woo together
- WooCommerce/Authorize.net interface problem
- populating extra field with woocommerce categories
- WooCommerce subscriptions give option of manual renewal on checkout [closed]
- Woocommerce Shop Manager Capabilities
- HTTP Error when uploading pictures and problem with the size of images
- add_rewrite_rule() returns 404 page
- How to set subcategory in Woocommerce?
- Redirect after login when WordPress in subdirectory
- Woocommerce – How to Show product tags in shop page
- Using category and its sub-categories products attributes as filter in products pages
- Bulk edit orders to ‘wc-processing’ status
- Woocommerce section name? [closed]
- how to change value return by _stock_status
- Retrieve Woocommerce Cart Url with javascript/jquery [closed]
- How to change “add to basket” button text in WooCommerce based on product category?
- WordPress redirects to login page when I enter url.com/index.php
- The orders in WooCommerce admin are hidden (they have the “hidden” CSS class)
- Select all product woocommerce
- Woocommerce REST API: creating variations
- How to hide / remove duplicated Woocommerce products from Shop page
- HOW do you Redirect buddypress login to EDIT tab not PROFILE tab on profile page? [closed]
- WooCommerce one time checkout pop up
- How to add a special Woocommerce “Buy Now” button?