<?php
/**
 * The7 theme.
 *
 * @since   1.0.0
 *
 * @package The7
 */


defined( 'ABSPATH' ) || exit;

/**
 * Set the content width based on the theme's design and stylesheet.
 *
 * @since 1.0.0
 */
if ( ! isset( $content_width ) ) {
	$content_width = 1200; /* pixels */
}

/**
 * Initialize theme.
 *
 * @since 1.0.0
 */
require trailingslashit( get_template_directory() ) . 'inc/init.php';

add_action( 'woocommerce_thankyou', 'thiagu_redirect');
function thiagu_redirect(){
    $url = home_url('/complete-profile/');
    wp_redirect($url);
    exit;
}


add_filter( 'woocommerce_is_sold_individually', 'product_max_1_cart_custom_field', 9999, 2 );
 
function product_max_1_cart_custom_field( $individually, $product ) {
   $acf_field_value = get_field( 'sold_individually', $product->get_id() );
   if ( $acf_field_value && 'true' == $acf_field_value ) {
      $individually = true;
   }
   return $individually;
}

