rv_redirect_to_url

The Woocommerce Add-to-Cart Custom Redirect rv redirect to url function.

Description

rv_redirect_to_url(); 

Usage

  1. if ( !function_exists( 'rv_redirect_to_url' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-add-to-cart-custom-redirect/woocommerce-custom-redirect.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = rv_redirect_to_url(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/woocommerce-custom-redirect.php  
  1. function rv_redirect_to_url() { 
  2.  
  3. global $woocommerce, $post; 
  4.  
  5. $product_id = apply_filters( 'woocommerce_add_to_cart_product_id', absint( $_REQUEST['add-to-cart'] ) ); 
  6.  
  7. $rv_woo_redirect_url = get_post_meta( $product_id, '_rv_woo_product_custom_redirect_url', true ); 
  8.  
  9. if ( ! empty( $rv_woo_redirect_url ) ) { 
  10.  
  11. wp_redirect( esc_url( $rv_woo_redirect_url ) ); exit; 
  12.  
  13.