Try with below code. i have tested and it is working fine for me.
add_filter( 'woocommerce_add_to_cart_redirect', 'acf_product_redirect' );
function acf_product_redirect() {
#Get product ID
if ( isset( $_REQUEST['add-to-cart'] ) || is_numeric( $_REQUEST['add-to-cart'] ) ) {
$product_id = (int) apply_filters( 'woocommerce_add_to_cart_product_id', $_REQUEST['add-to-cart'] );
# Check if redirect url set or not
if (!empty(get_field('redirect_url', $product_id))) {
$redirect_id = get_field('redirect_url', $product_id);
return get_permalink($redirect_id);
}
}
}
Let me know if this works for you.
Related Posts:
- How to check if is in cart page? [closed]
- Is it possible to add custom fields to a WooCommerce attribute term? [closed]
- How to display product price of the product in loop
- Remember page before login page, redirect to that page after login
- 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 Redirect not working [closed]
- Redirect user after login through woocommerce login page to page with his/her username?
- Redirect customer to login page (with other signup plugin) if user not logged in when proceeding to checkout
- Display Advanced Custom Fields value in Woocommerce admin order details
- Display custom field without plugin in woocommerce
- Woocommerce – Want to block a user agent from accessing specific product pages
- How to – proper WordPress 301 redirects?
- wp_set_object_terms being undone
- Woocommerce, prevent login after registration and redirect to custom URL
- How to give each category name its own ACF background color?
- Redirect no product url’s to static url
- WooCommerce Registration redirect based on page ID
- WooCommerce get_author_posts_url() – Author URL redirecting to shop base
- Need to check if user has completed a woo commerce payment
- How to retrieve a Menu Name by Menu Location with ACF fields
- Is it ok to 301 redirect product-category pages to custom pages?
- ACF in WooCommerce mail template
- wordpress site auto redirect to another site when I enable woocommerce
- creating number of database entries based on users numerical input
- mydomain.com/wp-login redirects to wordpress.com/wp-login
- How to store ACF from product in user_meta?
- how to get woocommerce product id by acf field in wordpress and display product
- How to get an Array from “select” field in advanced custom fields
- WooCommerce shop, my account, cart every page redirect to home page [closed]
- Insert a custom field as a second email address to a completed order in WooCommerce
- Add field to category woocommerce page
- acf_form() – “On Update” action [closed]
- Display single product attribute value on Shop page (Woocommerce)
- Woocommerce My Account Endpoint – how to get ID parameter from URL?
- How to add Woocomrce cart page shipping calculator to my country state list
- Button to update order status Woocommerce with WC Marketplace
- WooCommerce add_to_cart url not working [closed]
- WooCommerce: display text instead of raw checkbox value email
- How to build wordpress site which will have location based services & products?
- How we can edit variations on cart page? [closed]
- new WC_Order(); Coming Back Empty
- Is there any way to find which action/hook is fired?
- WooCommerce single products images doesn’t zoom on hover and doesn’t change clicking on gallery
- Order list woocommerce Orders based on meta for custom status
- WooCommerce hide unexisting variations
- How can I change the functionality of breadcrumbs?
- Variation name in $product->get_name()
- WordPress keeps moving my widgets to other widget areas
- How do I group product variations on cart page (Woocommerce)?
- Hide account tab to certain users
- How to Update the Order-Items While Editing an Order on the WooCommerce Admin Order Screen [closed]
- how to remove or disable woocommerce order review in checkout page?
- Is it safe to have 2 mysql users?
- WooCommerce – Add product with image via REST API
- How to get woocommerce selected variation from order object
- Adjust Price Display for Variable Product in Woocommerce [closed]
- Unable to pull in custom product attribute in shortcode [closed]
- How to remove product attribute row woocommerce using code
- How it it possible to disbale all WooCommerce scripts and styles, but keep wc-ajax=get_refreshed_fragments working? [closed]
- Woocommerce cart is not clear after logout
- Woocommerce : read [max_qty] using backorder
- Is there any way to pro-grammatically create product categories and assign thumbnails in PHP and WooCommerce?
- Append woocommerce category to product title globally? [closed]
- Custom fields values not being created
- One Time Access URL after purchasing subscription
- How to fetch WooCommerce products with 50% discount?
- Anonymous users can not access website
- How to make phone number become whatsapp link in back-end order details woocommerce
- How to show variations only which are in stock on shop page in woocommerce?
- select2 & selectWoo Not Loading Options
- Place product field value as variable in php
- WordPress & Woocommerce variation Price
- Adding country subdomain to an existing website like www.example.com/uk
- wc_mail in foreach loop is sending only the first email
- How to fix: “The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.” after malware cleaning
- Can’t update WooCommerce payment method title
- Set Post Thumbnail to external URL
- How to add product variations for large number of products in WooCommerce?
- WooCommerce related products load random posts per page
- Woocommerce Languages Files
- How to adjust Related Page Thumb Sizes on single page?
- Adding more than one item to Woocommerce cart
- Changing second user role while updating/downgrading membership level – s2member [closed]
- Woocommerce – get product in category with specific attribute
- How to edit the header banner in the search page in woocommerce?
- How can I display one product using WooCommerce
- How do I change the woocommerce product gallery to show all thumbnails instead of three at a time in a carousel?
- How to add a menu page for options in wordpress for user that has the role of vendor?
- How to edit schema.org markup of WooCommerce?
- Turkish Character Problem on mailing
- WooCommerce: Order Details Table > Add Product Meta
- Override function
- How to disable schema from Wocommerce? [closed]
- registration_errors not working
- Translate Woocommerce tab
- Woocommerce -> gallery images per variation without a plugin? [closed]
- Why is my WordPress admin not working
- Create bookings after subscription renewal